kuwahara types

This commit is contained in:
Tanasart 2024-12-12 11:48:59 +07:00
parent 08621ae6be
commit ee1a737e73
24 changed files with 584 additions and 145 deletions

View file

@ -183,6 +183,7 @@
{"name":"dither","order":53,"path":"folders/shader/filter/dither.yy",},
{"name":"edge_shade","order":44,"path":"folders/shader/filter/edge_shade.yy",},
{"name":"jpeg","order":55,"path":"folders/shader/filter/jpeg.yy",},
{"name":"kuwahara","order":14,"path":"folders/shader/filter/kuwahara.yy",},
{"name":"liquefy","order":60,"path":"folders/shader/filter/liquefy.yy",},
{"name":"morph","order":45,"path":"folders/shader/filter/morph.yy",},
{"name":"shadow_caster","order":46,"path":"folders/shader/filter/shadow_caster.yy",},
@ -1371,8 +1372,8 @@
{"name":"sh_active_canvas_ink","order":13,"path":"shaders/sh_active_canvas_ink/sh_active_canvas_ink.yy",},
{"name":"sh_alpha_grey","order":1,"path":"shaders/sh_alpha_grey/sh_alpha_grey.yy",},
{"name":"sh_alpha_hash","order":2,"path":"shaders/sh_alpha_hash/sh_alpha_hash.yy",},
{"name":"sh_atlas_scan","order":51,"path":"shaders/sh_atlas_scan/sh_atlas_scan.yy",},
{"name":"sh_atlas","order":12,"path":"shaders/sh_atlas/sh_atlas.yy",},
{"name":"sh_atlas_scan","order":52,"path":"shaders/sh_atlas_scan/sh_atlas_scan.yy",},
{"name":"sh_atlas","order":13,"path":"shaders/sh_atlas/sh_atlas.yy",},
{"name":"sh_bend_arc","order":13,"path":"shaders/sh_bend_arc/sh_bend_arc.yy",},
{"name":"sh_bevel_highp","order":3,"path":"shaders/sh_bevel_highp/sh_bevel_highp.yy",},
{"name":"sh_bevel","order":2,"path":"shaders/sh_bevel/sh_bevel.yy",},
@ -1410,7 +1411,7 @@
{"name":"sh_blink_expand","order":2,"path":"shaders/sh_blink_expand/sh_blink_expand.yy",},
{"name":"sh_blink_replace","order":1,"path":"shaders/sh_blink_replace/sh_blink_replace.yy",},
{"name":"sh_blobify","order":1,"path":"shaders/sh_blobify/sh_blobify.yy",},
{"name":"sh_bloom_pass","order":2,"path":"shaders/sh_bloom_pass/sh_bloom_pass.yy",},
{"name":"sh_bloom_pass","order":3,"path":"shaders/sh_bloom_pass/sh_bloom_pass.yy",},
{"name":"sh_blur_alpha","order":2,"path":"shaders/sh_blur_alpha/sh_blur_alpha.yy",},
{"name":"sh_blur_bokeh","order":3,"path":"shaders/sh_blur_bokeh/sh_blur_bokeh.yy",},
{"name":"sh_blur_box_contrast","order":4,"path":"shaders/sh_blur_box_contrast/sh_blur_box_contrast.yy",},
@ -1424,7 +1425,7 @@
{"name":"sh_blur_slope","order":11,"path":"shaders/sh_blur_slope/sh_blur_slope.yy",},
{"name":"sh_blur_zoom","order":12,"path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",},
{"name":"sh_box_pattern","order":29,"path":"shaders/sh_box_pattern/sh_box_pattern.yy",},
{"name":"sh_brush_linear","order":56,"path":"shaders/sh_brush_linear/sh_brush_linear.yy",},
{"name":"sh_brush_linear","order":57,"path":"shaders/sh_brush_linear/sh_brush_linear.yy",},
{"name":"sh_brush_outline","order":7,"path":"shaders/sh_brush_outline/sh_brush_outline.yy",},
{"name":"sh_bw","order":3,"path":"shaders/sh_bw/sh_bw.yy",},
{"name":"sh_canvas_apply_draw","order":3,"path":"shaders/sh_canvas_apply_draw/sh_canvas_apply_draw.yy",},
@ -1451,8 +1452,8 @@
{"name":"sh_channel_S","order":5,"path":"shaders/sh_channel_S/sh_channel_S.yy",},
{"name":"sh_channel_V","order":6,"path":"shaders/sh_channel_V/sh_channel_V.yy",},
{"name":"sh_checkerboard","order":3,"path":"shaders/sh_checkerboard/sh_checkerboard.yy",},
{"name":"sh_chromatic_aberration","order":16,"path":"shaders/sh_chromatic_aberration/sh_chromatic_aberration.yy",},
{"name":"sh_clean_shape","order":21,"path":"shaders/sh_clean_shape/sh_clean_shape.yy",},
{"name":"sh_chromatic_aberration","order":17,"path":"shaders/sh_chromatic_aberration/sh_chromatic_aberration.yy",},
{"name":"sh_clean_shape","order":22,"path":"shaders/sh_clean_shape/sh_clean_shape.yy",},
{"name":"sh_color_adjust","order":4,"path":"shaders/sh_color_adjust/sh_color_adjust.yy",},
{"name":"sh_color_picker_side_hue","order":2,"path":"shaders/sh_color_picker_side_hue/sh_color_picker_side_hue.yy",},
{"name":"sh_color_picker_side_value","order":3,"path":"shaders/sh_color_picker_side_value/sh_color_picker_side_value.yy",},
@ -1461,18 +1462,18 @@
{"name":"sh_color_replace","order":8,"path":"shaders/sh_color_replace/sh_color_replace.yy",},
{"name":"sh_color_select_content","order":1,"path":"shaders/sh_color_select_content/sh_color_select_content.yy",},
{"name":"sh_colorize","order":9,"path":"shaders/sh_colorize/sh_colorize.yy",},
{"name":"sh_colours_replace","order":30,"path":"shaders/sh_colours_replace/sh_colours_replace.yy",},
{"name":"sh_colours_replace","order":31,"path":"shaders/sh_colours_replace/sh_colours_replace.yy",},
{"name":"sh_combine_hsv","order":10,"path":"shaders/sh_combine_hsv/sh_combine_hsv.yy",},
{"name":"sh_combine_rgb","order":11,"path":"shaders/sh_combine_rgb/sh_combine_rgb.yy",},
{"name":"sh_content_sampler","order":1,"path":"shaders/sh_content_sampler/sh_content_sampler.yy",},
{"name":"sh_convolution","order":23,"path":"shaders/sh_convolution/sh_convolution.yy",},
{"name":"sh_convolution","order":24,"path":"shaders/sh_convolution/sh_convolution.yy",},
{"name":"sh_coord","order":30,"path":"shaders/sh_coord/sh_coord.yy",},
{"name":"sh_corner_erode","order":1,"path":"shaders/sh_corner_erode/sh_corner_erode.yy",},
{"name":"sh_corner_iterate","order":2,"path":"shaders/sh_corner_iterate/sh_corner_iterate.yy",},
{"name":"sh_cross_histogram","order":26,"path":"shaders/sh_cross_histogram/sh_cross_histogram.yy",},
{"name":"sh_cross_section","order":25,"path":"shaders/sh_cross_section/sh_cross_section.yy",},
{"name":"sh_curve_hsv","order":54,"path":"shaders/sh_curve_hsv/sh_curve_hsv.yy",},
{"name":"sh_curve","order":3,"path":"shaders/sh_curve/sh_curve.yy",},
{"name":"sh_curve_hsv","order":55,"path":"shaders/sh_curve_hsv/sh_curve_hsv.yy",},
{"name":"sh_curve","order":4,"path":"shaders/sh_curve/sh_curve.yy",},
{"name":"sh_d3d_3d_transform","order":15,"path":"shaders/sh_d3d_3d_transform/sh_d3d_3d_transform.yy",},
{"name":"sh_d3d_background","order":8,"path":"shaders/sh_d3d_background/sh_d3d_background.yy",},
{"name":"sh_d3d_extrude_extends","order":11,"path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",},
@ -1486,8 +1487,8 @@
{"name":"sh_d3d_silhouette","order":2,"path":"shaders/sh_d3d_silhouette/sh_d3d_silhouette.yy",},
{"name":"sh_d3d_ssao_blur","order":1,"path":"shaders/sh_d3d_ssao_blur/sh_d3d_ssao_blur.yy",},
{"name":"sh_d3d_wireframe","order":4,"path":"shaders/sh_d3d_wireframe/sh_d3d_wireframe.yy",},
{"name":"sh_de_corner","order":6,"path":"shaders/sh_de_corner/sh_de_corner.yy",},
{"name":"sh_de_stray","order":7,"path":"shaders/sh_de_stray/sh_de_stray.yy",},
{"name":"sh_de_corner","order":7,"path":"shaders/sh_de_corner/sh_de_corner.yy",},
{"name":"sh_de_stray","order":8,"path":"shaders/sh_de_stray/sh_de_stray.yy",},
{"name":"sh_default","order":6,"path":"shaders/sh_default/sh_default.yy",},
{"name":"sh_dialog_palette_selector","order":7,"path":"shaders/sh_dialog_palette_selector/sh_dialog_palette_selector.yy",},
{"name":"sh_diffuse_flow","order":1,"path":"shaders/sh_diffuse_flow/sh_diffuse_flow.yy",},
@ -1516,10 +1517,10 @@
{"name":"sh_draw_tile_clear","order":4,"path":"shaders/sh_draw_tile_clear/sh_draw_tile_clear.yy",},
{"name":"sh_draw_tile_map","order":5,"path":"shaders/sh_draw_tile_map/sh_draw_tile_map.yy",},
{"name":"sh_draw_tile","order":1,"path":"shaders/sh_draw_tile/sh_draw_tile.yy",},
{"name":"sh_edge_detect","order":35,"path":"shaders/sh_edge_detect/sh_edge_detect.yy",},
{"name":"sh_edge_detect","order":36,"path":"shaders/sh_edge_detect/sh_edge_detect.yy",},
{"name":"sh_edge_shade_apply","order":2,"path":"shaders/sh_edge_shade_apply/sh_edge_shade_apply.yy",},
{"name":"sh_edge_shade_convert","order":1,"path":"shaders/sh_edge_shade_convert/sh_edge_shade_convert.yy",},
{"name":"sh_erode","order":8,"path":"shaders/sh_erode/sh_erode.yy",},
{"name":"sh_erode","order":9,"path":"shaders/sh_erode/sh_erode.yy",},
{"name":"sh_fd_add_velocity","order":1,"path":"shaders/sh_fd_add_velocity/sh_fd_add_velocity.yy",},
{"name":"sh_fd_advect_material","order":2,"path":"shaders/sh_fd_advect_material/sh_fd_advect_material.yy",},
{"name":"sh_fd_advect_velocity","order":7,"path":"shaders/sh_fd_advect_velocity/sh_fd_advect_velocity.yy",},
@ -1540,11 +1541,11 @@
{"name":"sh_flood_fill_replace","order":2,"path":"shaders/sh_flood_fill_replace/sh_flood_fill_replace.yy",},
{"name":"sh_freeform_fill_cleanup","order":2,"path":"shaders/sh_freeform_fill_cleanup/sh_freeform_fill_cleanup.yy",},
{"name":"sh_freeform_fill_pass2","order":1,"path":"shaders/sh_freeform_fill_pass2/sh_freeform_fill_pass2.yy",},
{"name":"sh_FXAA","order":29,"path":"shaders/sh_FXAA/sh_FXAA.yy",},
{"name":"sh_gamma_map","order":38,"path":"shaders/sh_gamma_map/sh_gamma_map.yy",},
{"name":"sh_FXAA","order":30,"path":"shaders/sh_FXAA/sh_FXAA.yy",},
{"name":"sh_gamma_map","order":39,"path":"shaders/sh_gamma_map/sh_gamma_map.yy",},
{"name":"sh_get_max_downsampled","order":8,"path":"shaders/sh_get_max_downsampled/sh_get_max_downsampled.yy",},
{"name":"sh_get_min_downsampled","order":9,"path":"shaders/sh_get_min_downsampled/sh_get_min_downsampled.yy",},
{"name":"sh_glow","order":18,"path":"shaders/sh_glow/sh_glow.yy",},
{"name":"sh_glow","order":19,"path":"shaders/sh_glow/sh_glow.yy",},
{"name":"sh_gradient_display_alpha","order":12,"path":"shaders/sh_gradient_display_alpha/sh_gradient_display_alpha.yy",},
{"name":"sh_gradient_display","order":7,"path":"shaders/sh_gradient_display/sh_gradient_display.yy",},
{"name":"sh_gradient_points","order":8,"path":"shaders/sh_gradient_points/sh_gradient_points.yy",},
@ -1558,21 +1559,24 @@
{"name":"sh_grid_tri","order":3,"path":"shaders/sh_grid_tri/sh_grid_tri.yy",},
{"name":"sh_herringbone_tile","order":5,"path":"shaders/sh_herringbone_tile/sh_herringbone_tile.yy",},
{"name":"sh_high_pass","order":15,"path":"shaders/sh_high_pass/sh_high_pass.yy",},
{"name":"sh_image_trace","order":34,"path":"shaders/sh_image_trace/sh_image_trace.yy",},
{"name":"sh_interlaced","order":58,"path":"shaders/sh_interlaced/sh_interlaced.yy",},
{"name":"sh_image_trace","order":35,"path":"shaders/sh_image_trace/sh_image_trace.yy",},
{"name":"sh_interlaced","order":59,"path":"shaders/sh_interlaced/sh_interlaced.yy",},
{"name":"sh_invert","order":17,"path":"shaders/sh_invert/sh_invert.yy",},
{"name":"sh_jpeg_recons","order":1,"path":"shaders/sh_jpeg_recons/sh_jpeg_recons.yy",},
{"name":"sh_kuwahara_ani","order":37,"path":"shaders/sh_kuwahara_ani/sh_kuwahara_ani.yy",},
{"name":"sh_kuwahara","order":36,"path":"shaders/sh_kuwahara/sh_kuwahara.yy",},
{"name":"sh_kuwahara_ani_pass1","order":1,"path":"shaders/sh_kuwahara_ani_pass1/sh_kuwahara_ani_pass1.yy",},
{"name":"sh_kuwahara_ani_pass2","order":2,"path":"shaders/sh_kuwahara_ani_pass2/sh_kuwahara_ani_pass2.yy",},
{"name":"sh_kuwahara_ani_pass3","order":3,"path":"shaders/sh_kuwahara_ani_pass3/sh_kuwahara_ani_pass3.yy",},
{"name":"sh_kuwahara_ani_pass4","order":4,"path":"shaders/sh_kuwahara_ani_pass4/sh_kuwahara_ani_pass4.yy",},
{"name":"sh_kuwahara_gen","order":5,"path":"shaders/sh_kuwahara_gen/sh_kuwahara_gen.yy",},
{"name":"sh_level_selector","order":15,"path":"shaders/sh_level_selector/sh_level_selector.yy",},
{"name":"sh_level","order":14,"path":"shaders/sh_level/sh_level.yy",},
{"name":"sh_liquefy_bloat","order":3,"path":"shaders/sh_liquefy_bloat/sh_liquefy_bloat.yy",},
{"name":"sh_liquefy_pinch","order":2,"path":"shaders/sh_liquefy_pinch/sh_liquefy_pinch.yy",},
{"name":"sh_liquefy_twirl","order":1,"path":"shaders/sh_liquefy_twirl/sh_liquefy_twirl.yy",},
{"name":"sh_local_analyze","order":25,"path":"shaders/sh_local_analyze/sh_local_analyze.yy",},
{"name":"sh_local_analyze","order":24,"path":"shaders/sh_local_analyze/sh_local_analyze.yy",},
{"name":"sh_lovify","order":2,"path":"shaders/sh_lovify/sh_lovify.yy",},
{"name":"sh_lum2alpha","order":16,"path":"shaders/sh_lum2alpha/sh_lum2alpha.yy",},
{"name":"sh_mask_expand","order":31,"path":"shaders/sh_mask_expand/sh_mask_expand.yy",},
{"name":"sh_mask_expand","order":30,"path":"shaders/sh_mask_expand/sh_mask_expand.yy",},
{"name":"sh_mask_invert","order":20,"path":"shaders/sh_mask_invert/sh_mask_invert.yy",},
{"name":"sh_mask_modify","order":2,"path":"shaders/sh_mask_modify/sh_mask_modify.yy",},
{"name":"sh_mesh_generation","order":3,"path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},
@ -1616,13 +1620,13 @@
{"name":"sh_normal_light","order":1,"path":"shaders/sh_normal_light/sh_normal_light.yy",},
{"name":"sh_normalize","order":23,"path":"shaders/sh_normalize/sh_normalize.yy",},
{"name":"sh_offset","order":12,"path":"shaders/sh_offset/sh_offset.yy",},
{"name":"sh_outline_only","order":19,"path":"shaders/sh_outline_only/sh_outline_only.yy",},
{"name":"sh_outline","order":9,"path":"shaders/sh_outline/sh_outline.yy",},
{"name":"sh_outline_only","order":18,"path":"shaders/sh_outline_only/sh_outline_only.yy",},
{"name":"sh_outline","order":8,"path":"shaders/sh_outline/sh_outline.yy",},
{"name":"sh_override_channel","order":21,"path":"shaders/sh_override_channel/sh_override_channel.yy",},
{"name":"sh_palette_mixer_atlas_expand_apply","order":2,"path":"shaders/sh_palette_mixer_atlas_expand_apply/sh_palette_mixer_atlas_expand_apply.yy",},
{"name":"sh_palette_mixer_atlas_expand_iterate","order":1,"path":"shaders/sh_palette_mixer_atlas_expand_iterate/sh_palette_mixer_atlas_expand_iterate.yy",},
{"name":"sh_palette_mixer_atlas_expand_palette","order":3,"path":"shaders/sh_palette_mixer_atlas_expand_palette/sh_palette_mixer_atlas_expand_palette.yy",},
{"name":"sh_palette_replace","order":24,"path":"shaders/sh_palette_replace/sh_palette_replace.yy",},
{"name":"sh_palette_replace","order":23,"path":"shaders/sh_palette_replace/sh_palette_replace.yy",},
{"name":"sh_palette_shift","order":19,"path":"shaders/sh_palette_shift/sh_palette_shift.yy",},
{"name":"sh_path_fill_profile","order":15,"path":"shaders/sh_path_fill_profile/sh_path_fill_profile.yy",},
{"name":"sh_pb_blob","order":1,"path":"shaders/sh_pb_blob/sh_pb_blob.yy",},
@ -1640,12 +1644,12 @@
{"name":"sh_perlin_tiled","order":15,"path":"shaders/sh_perlin_tiled/sh_perlin_tiled.yy",},
{"name":"sh_perlin","order":12,"path":"shaders/sh_perlin/sh_perlin.yy",},
{"name":"sh_pixel_cloud","order":4,"path":"shaders/sh_pixel_cloud/sh_pixel_cloud.yy",},
{"name":"sh_pixel_math","order":59,"path":"shaders/sh_pixel_math/sh_pixel_math.yy",},
{"name":"sh_pixel_math","order":58,"path":"shaders/sh_pixel_math/sh_pixel_math.yy",},
{"name":"sh_pixel_sample","order":27,"path":"shaders/sh_pixel_sample/sh_pixel_sample.yy",},
{"name":"sh_pixel_sort","order":20,"path":"shaders/sh_pixel_sort/sh_pixel_sort.yy",},
{"name":"sh_pixel_sort","order":19,"path":"shaders/sh_pixel_sort/sh_pixel_sort.yy",},
{"name":"sh_polar","order":1,"path":"shaders/sh_polar/sh_polar.yy",},
{"name":"sh_posterize_palette","order":5,"path":"shaders/sh_posterize_palette/sh_posterize_palette.yy",},
{"name":"sh_posterize","order":10,"path":"shaders/sh_posterize/sh_posterize.yy",},
{"name":"sh_posterize_palette","order":4,"path":"shaders/sh_posterize_palette/sh_posterize_palette.yy",},
{"name":"sh_posterize","order":9,"path":"shaders/sh_posterize/sh_posterize.yy",},
{"name":"sh_preview_histogram_outline","order":1,"path":"shaders/sh_preview_histogram_outline/sh_preview_histogram_outline.yy",},
{"name":"sh_pytagorean_tile","order":4,"path":"shaders/sh_pytagorean_tile/sh_pytagorean_tile.yy",},
{"name":"sh_quarsicrystal","order":14,"path":"shaders/sh_quarsicrystal/sh_quarsicrystal.yy",},
@ -1665,20 +1669,19 @@
{"name":"sh_region_fill_rg_coord","order":11,"path":"shaders/sh_region_fill_rg_coord/sh_region_fill_rg_coord.yy",},
{"name":"sh_region_fill_rg_index","order":12,"path":"shaders/sh_region_fill_rg_index/sh_region_fill_rg_index.yy",},
{"name":"sh_region_fill_rg_map","order":7,"path":"shaders/sh_region_fill_rg_map/sh_region_fill_rg_map.yy",},
{"name":"sh_remove_black","order":17,"path":"shaders/sh_remove_black/sh_remove_black.yy",},
{"name":"sh_remove_black","order":16,"path":"shaders/sh_remove_black/sh_remove_black.yy",},
{"name":"sh_replace_color","order":4,"path":"shaders/sh_replace_color/sh_replace_color.yy",},
{"name":"sh_rim","order":39,"path":"shaders/sh_rim/sh_rim.yy",},
{"name":"sh_rim","order":38,"path":"shaders/sh_rim/sh_rim.yy",},
{"name":"sh_rm_cloud","order":2,"path":"shaders/sh_rm_cloud/sh_rm_cloud.yy",},
{"name":"sh_rm_terrain","order":1,"path":"shaders/sh_rm_terrain/sh_rm_terrain.yy",},
{"name":"sh_rsh_erode","order":2,"path":"shaders/sh_rsh_erode/sh_rsh_erode.yy",},
{"name":"sh_rsh_rotate","order":1,"path":"shaders/sh_rsh_rotate/sh_rsh_rotate.yy",},
{"name":"sh_sample_points","order":9,"path":"shaders/sh_sample_points/sh_sample_points.yy",},
{"name":"sh_sao","order":4,"path":"shaders/sh_sao/sh_sao.yy",},
{"name":"sh_scale_cleanedge","order":57,"path":"shaders/sh_scale_cleanedge/sh_scale_cleanedge.yy",},
{"name":"sh_scale2x","order":13,"path":"shaders/sh_scale2x/sh_scale2x.yy",},
{"name":"sh_scale3x","order":15,"path":"shaders/sh_scale3x/sh_scale3x.yy",},
{"name":"sh_sdf_dist","order":4,"path":"shaders/sh_sdf_dist/sh_sdf_dist.yy",},
{"name":"sh_sdf","order":1,"path":"shaders/sh_sdf/sh_sdf.yy",},
{"name":"sh_scale_cleanedge","order":56,"path":"shaders/sh_scale_cleanedge/sh_scale_cleanedge.yy",},
{"name":"sh_scale2x","order":12,"path":"shaders/sh_scale2x/sh_scale2x.yy",},
{"name":"sh_scale3x","order":14,"path":"shaders/sh_scale3x/sh_scale3x.yy",},
{"name":"sh_sdf_dist","order":3,"path":"shaders/sh_sdf_dist/sh_sdf_dist.yy",},
{"name":"sh_seperate_shape_counter","order":1,"path":"shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.yy",},
{"name":"sh_seperate_shape_ite","order":2,"path":"shaders/sh_seperate_shape_ite/sh_seperate_shape_ite.yy",},
{"name":"sh_seperate_shape_sep","order":3,"path":"shaders/sh_seperate_shape_sep/sh_seperate_shape_sep.yy",},
@ -1698,10 +1701,10 @@
{"name":"sh_surface_replace_fast_replace","order":3,"path":"shaders/sh_surface_replace_fast_replace/sh_surface_replace_fast_replace.yy",},
{"name":"sh_surface_replace_replace","order":1,"path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",},
{"name":"sh_svg_fill","order":1,"path":"shaders/sh_svg_fill/sh_svg_fill.yy",},
{"name":"sh_texture_atlas","order":22,"path":"shaders/sh_texture_atlas/sh_texture_atlas.yy",},
{"name":"sh_texture_remap","order":11,"path":"shaders/sh_texture_remap/sh_texture_remap.yy",},
{"name":"sh_texture_atlas","order":21,"path":"shaders/sh_texture_atlas/sh_texture_atlas.yy",},
{"name":"sh_texture_remap","order":10,"path":"shaders/sh_texture_remap/sh_texture_remap.yy",},
{"name":"sh_threshold","order":18,"path":"shaders/sh_threshold/sh_threshold.yy",},
{"name":"sh_tile_random","order":32,"path":"shaders/sh_tile_random/sh_tile_random.yy",},
{"name":"sh_tile_random","order":31,"path":"shaders/sh_tile_random/sh_tile_random.yy",},
{"name":"sh_tile_rule_apply","order":9,"path":"shaders/sh_tile_rule_apply/sh_tile_rule_apply.yy",},
{"name":"sh_tile_rule_select","order":10,"path":"shaders/sh_tile_rule_select/sh_tile_rule_select.yy",},
{"name":"sh_tiler_autoterrain_apply","order":8,"path":"shaders/sh_tiler_autoterrain_apply/sh_tiler_autoterrain_apply.yy",},
@ -1709,9 +1712,9 @@
{"name":"sh_tiler_convert_mask","order":12,"path":"shaders/sh_tiler_convert_mask/sh_tiler_convert_mask.yy",},
{"name":"sh_tiler_convert","order":11,"path":"shaders/sh_tiler_convert/sh_tiler_convert.yy",},
{"name":"sh_time_remap","order":2,"path":"shaders/sh_time_remap/sh_time_remap.yy",},
{"name":"sh_trail_filler_pass1","order":26,"path":"shaders/sh_trail_filler_pass1/sh_trail_filler_pass1.yy",},
{"name":"sh_trail_filler_pass2","order":28,"path":"shaders/sh_trail_filler_pass2/sh_trail_filler_pass2.yy",},
{"name":"sh_trail_filler","order":27,"path":"shaders/sh_trail_filler/sh_trail_filler.yy",},
{"name":"sh_trail_filler_pass1","order":25,"path":"shaders/sh_trail_filler_pass1/sh_trail_filler_pass1.yy",},
{"name":"sh_trail_filler_pass2","order":27,"path":"shaders/sh_trail_filler_pass2/sh_trail_filler_pass2.yy",},
{"name":"sh_trail_filler","order":26,"path":"shaders/sh_trail_filler/sh_trail_filler.yy",},
{"name":"sh_twirl","order":3,"path":"shaders/sh_twirl/sh_twirl.yy",},
{"name":"sh_ui_shape_circle","order":4,"path":"shaders/sh_ui_shape_circle/sh_ui_shape_circle.yy",},
{"name":"sh_ui_slider","order":1,"path":"shaders/sh_ui_slider/sh_ui_slider.yy",},
@ -1719,7 +1722,7 @@
{"name":"sh_vertex_normal_pass","order":3,"path":"shaders/sh_vertex_normal_pass/sh_vertex_normal_pass.yy",},
{"name":"sh_vertex_pnt_light","order":4,"path":"shaders/sh_vertex_pnt_light/sh_vertex_pnt_light.yy",},
{"name":"sh_vertex_pt","order":5,"path":"shaders/sh_vertex_pt/sh_vertex_pt.yy",},
{"name":"sh_vignette","order":33,"path":"shaders/sh_vignette/sh_vignette.yy",},
{"name":"sh_vignette","order":32,"path":"shaders/sh_vignette/sh_vignette.yy",},
{"name":"sh_voronoi_extra","order":17,"path":"shaders/sh_voronoi_extra/sh_voronoi_extra.yy",},
{"name":"sh_warp_4points_pers","order":10,"path":"shaders/sh_warp_4points_pers/sh_warp_4points_pers.yy",},
{"name":"sh_warp_4points","order":9,"path":"shaders/sh_warp_4points/sh_warp_4points.yy",},

View file

@ -287,6 +287,7 @@
{"$GMFolder":"","%Name":"dither","folderPath":"folders/shader/filter/dither.yy","name":"dither","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"edge_shade","folderPath":"folders/shader/filter/edge_shade.yy","name":"edge_shade","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"jpeg","folderPath":"folders/shader/filter/jpeg.yy","name":"jpeg","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"kuwahara","folderPath":"folders/shader/filter/kuwahara.yy","name":"kuwahara","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"liquefy","folderPath":"folders/shader/filter/liquefy.yy","name":"liquefy","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"morph","folderPath":"folders/shader/filter/morph.yy","name":"morph","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"shadow_caster","folderPath":"folders/shader/filter/shadow_caster.yy","name":"shadow_caster","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -2224,7 +2225,11 @@
{"id":{"name":"sh_invert","path":"shaders/sh_invert/sh_invert.yy",},},
{"id":{"name":"sh_jpeg_dct","path":"shaders/sh_jpeg_dct/sh_jpeg_dct.yy",},},
{"id":{"name":"sh_jpeg_recons","path":"shaders/sh_jpeg_recons/sh_jpeg_recons.yy",},},
{"id":{"name":"sh_kuwahara_ani","path":"shaders/sh_kuwahara_ani/sh_kuwahara_ani.yy",},},
{"id":{"name":"sh_kuwahara_ani_pass1","path":"shaders/sh_kuwahara_ani_pass1/sh_kuwahara_ani_pass1.yy",},},
{"id":{"name":"sh_kuwahara_ani_pass2","path":"shaders/sh_kuwahara_ani_pass2/sh_kuwahara_ani_pass2.yy",},},
{"id":{"name":"sh_kuwahara_ani_pass3","path":"shaders/sh_kuwahara_ani_pass3/sh_kuwahara_ani_pass3.yy",},},
{"id":{"name":"sh_kuwahara_ani_pass4","path":"shaders/sh_kuwahara_ani_pass4/sh_kuwahara_ani_pass4.yy",},},
{"id":{"name":"sh_kuwahara_gen","path":"shaders/sh_kuwahara_gen/sh_kuwahara_gen.yy",},},
{"id":{"name":"sh_kuwahara","path":"shaders/sh_kuwahara/sh_kuwahara.yy",},},
{"id":{"name":"sh_level_selector","path":"shaders/sh_level_selector/sh_level_selector.yy",},},
{"id":{"name":"sh_level","path":"shaders/sh_level/sh_level.yy",},},

View file

@ -21,13 +21,27 @@ function Node_Kuwahara(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
__init_mask_modifier(3); // inputs 7, 8
newInput(9, nodeValue_Enum_Scroll("Types", self, 0, [ "Basic", "Anisotropics", "Generalized" ]));
newInput(10, nodeValue_Float("Alpha", self, 1))
.setDisplay(VALUE_DISPLAY.slider);
newInput(11, nodeValue_Float("Zero crossing", self, 0.58))
.setDisplay(VALUE_DISPLAY.slider);
newInput(12, nodeValue_Float("Hardness", self, 8))
newInput(13, nodeValue_Float("Sharpness", self, 8))
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
input_display_list = [ 1,
["Surfaces", true], 0, 3, 4, 7, 8,
["Effects", true], 2
["Surfaces", true], 0, 3, 4, 7, 8,
["Effects", false], 9, 2, 10, 11, 12, 13,
];
temp_surfaces = array_create(4);
attribute_surface_depth();
static step = function() {
@ -35,17 +49,77 @@ function Node_Kuwahara(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _surf = _data[0];
var _type = _data[9];
var _dim = surface_get_dimension(_surf);
surface_set_shader(_outSurf, sh_kuwahara);
shader_set_f("dimension", surface_get_dimension(_data[0]));
shader_set_i("radius", _data[2]);
inputs[10].setVisible(_type == 1);
inputs[11].setVisible(_type != 0);
inputs[12].setVisible(_type != 0);
inputs[13].setVisible(_type != 0);
switch(_type) {
case 0 :
surface_set_shader(_outSurf, sh_kuwahara);
shader_set_2("dimension", _dim);
shader_set_i("radius", _data[2]);
draw_surface_safe(_surf);
surface_reset_shader();
break;
draw_surface_safe(_data[0]);
surface_reset_shader();
case 1 :
for( var i = 0; i < 3; i++ ) temp_surfaces[i] = surface_verify(temp_surfaces[i], _dim[0], _dim[1]);
surface_set_shader(temp_surfaces[0], sh_kuwahara_ani_pass1);
shader_set_2("dimension", _dim);
draw_surface_safe(_surf);
surface_reset_shader();
surface_set_shader(temp_surfaces[1], sh_kuwahara_ani_pass2);
shader_set_2("dimension", _dim);
draw_surface_safe(temp_surfaces[0]);
surface_reset_shader();
surface_set_shader(temp_surfaces[2], sh_kuwahara_ani_pass3);
shader_set_2("dimension", _dim);
draw_surface_safe(temp_surfaces[1]);
surface_reset_shader();
surface_set_shader(_outSurf, sh_kuwahara_ani_pass4);
shader_set_surface("tfm", temp_surfaces[2]);
shader_set_2("dimension", _dim);
shader_set_f("alpha", _data[10]);
shader_set_i("kernelSize", _data[2]);
shader_set_f("zeroCrossing", _data[11]);
shader_set_f("hardness", _data[12]);
shader_set_f("sharpness", _data[13]);
draw_surface_safe(_surf);
surface_reset_shader();
break;
case 2 :
surface_set_shader(_outSurf, sh_kuwahara_gen);
shader_set_2("dimension", _dim);
shader_set_i("kernelSize", _data[2]);
shader_set_f("zeroCrossing", _data[11]);
shader_set_f("hardness", _data[12]);
shader_set_f("sharpness", _data[13]);
draw_surface_safe(_surf);
surface_reset_shader();
break;
}
__process_mask_modifier(_data);
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);
_outSurf = channel_apply(_data[0], _outSurf, _data[6]);
_outSurf = mask_apply(_surf, _outSurf, _data[3], _data[4]);
_outSurf = channel_apply(_surf, _outSurf, _data[6]);
return _outSurf;
}

View file

@ -3,8 +3,8 @@
"%Name":"sh_kuwahara",
"name":"sh_kuwahara",
"parent":{
"name":"filter",
"path":"folders/shader/filter.yy",
"name":"kuwahara",
"path":"folders/shader/filter/kuwahara.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",

View file

@ -1,57 +0,0 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define MAX_RAD 64
uniform vec2 dimension;
uniform int radius;
void main () {
gl_FragColor = texture2D(gm_BaseTexture, v_vTexcoord);
vec2 tx = 1. / dimension;
float n = float((radius + 1) * (radius + 1));
vec3 m[4];
vec3 s[4];
vec3 c;
for (int k = 0; k < 4; ++k) {
m[k] = vec3(0.0);
s[k] = vec3(0.0);
}
for (int j = 0; j <= MAX_RAD; j++)
for (int i = 0; i <= MAX_RAD; i++) {
if(i > radius) continue;
if(j > radius) break;
c = texture2D(gm_BaseTexture, v_vTexcoord + vec2(-i, -j) * tx).rgb;
m[0] += c;
s[0] += c * c;
c = texture2D(gm_BaseTexture, v_vTexcoord + vec2( i, -j) * tx).rgb;
m[1] += c;
s[1] += c * c;
c = texture2D(gm_BaseTexture, v_vTexcoord + vec2( i, j) * tx).rgb;
m[2] += c;
s[2] += c * c;
c = texture2D(gm_BaseTexture, v_vTexcoord + vec2(-i, j) * tx).rgb;
m[3] += c;
s[3] += c * c;
}
float min_sigma2 = 100.;
for (int k = 0; k < 4; k++) {
m[k] /= n;
s[k] = abs(s[k] / n - m[k] * m[k]);
float sigma2 = s[k].r + s[k].g + s[k].b;
if (sigma2 < min_sigma2) {
min_sigma2 = sigma2;
gl_FragColor = vec4(m[k], 1.0);
}
}
}

View file

@ -1 +0,0 @@
// Date: 2024-10-15T09:38:04.7822289+07:00

View file

@ -1,18 +0,0 @@
//
// Simple passthrough vertex shader
//
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -1 +0,0 @@
// Date: 2024-10-15T09:38:04.7823883+07:00

View file

@ -1,12 +0,0 @@
{
"$GMShader":"",
"%Name":"sh_kuwahara_ani",
"name":"sh_kuwahara_ani",
"parent":{
"name":"filter",
"path":"folders/shader/filter.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"type":1,
}

View file

@ -0,0 +1,30 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
void main() {
vec2 tx = 1. / dimension;
vec2 d = tx;
vec3 Sx = (
1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2(-d.x, -d.y)).rgb +
2. * texture2D(gm_BaseTexture, v_vTexcoord + vec2(-d.x, 0.0)).rgb +
1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2(-d.x, d.y)).rgb +
-1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( d.x, -d.y)).rgb +
-2. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( d.x, 0.0)).rgb +
-1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( d.x, d.y)).rgb
) / 4.;
vec3 Sy = (
1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2(-d.x, -d.y)).rgb +
2. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( 0.0, -d.y)).rgb +
1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( d.x, -d.y)).rgb +
-1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2(-d.x, d.y)).rgb +
-2. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( 0.0, d.y)).rgb +
-1. * texture2D(gm_BaseTexture, v_vTexcoord + vec2( d.x, d.y)).rgb
) / 4.;
gl_FragColor = vec4(dot(Sx, Sx), dot(Sy, Sy), dot(Sx, Sy), 1.);
}

View file

@ -0,0 +1,14 @@
attribute vec3 in_Position; // (x, y, z)
attribute vec4 in_Colour; // (r, g, b, a)
attribute vec2 in_TextureCoord; // (u, v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec4 object_space_pos = vec4(in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,13 @@
{
"$GMShader":"",
"%Name":"sh_kuwahara_ani_pass1",
"name":"sh_kuwahara_ani_pass1",
"parent":{
"name":"kuwahara",
"path":"folders/shader/filter/kuwahara.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"tags":[],
"type":1,
}

View file

@ -0,0 +1,26 @@
#define PI 3.14159265358979323846
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
float gaussian(float sigma, float pos) { return (1.0 / sqrt(2.0 * PI * sigma * sigma)) * exp(-(pos * pos) / (2.0 * sigma * sigma)); }
void main() {
vec2 tx = 1. / dimension;
int kernelRadius = 5;
float kernelSum = 0.0;
vec4 col = vec4(0.);
for (int x = -kernelRadius; x <= kernelRadius; ++x) {
vec4 c = texture2D(gm_BaseTexture, v_vTexcoord + vec2(x, 0.) * tx);
float gauss = gaussian(2.0, float(x));
col += c * gauss;
kernelSum += gauss;
}
gl_FragColor = col / kernelSum;
}

View file

@ -0,0 +1,14 @@
attribute vec3 in_Position; // (x, y, z)
attribute vec4 in_Colour; // (r, g, b, a)
attribute vec2 in_TextureCoord; // (u, v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec4 object_space_pos = vec4(in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,13 @@
{
"$GMShader":"",
"%Name":"sh_kuwahara_ani_pass2",
"name":"sh_kuwahara_ani_pass2",
"parent":{
"name":"kuwahara",
"path":"folders/shader/filter/kuwahara.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"tags":[],
"type":1,
}

View file

@ -0,0 +1,37 @@
#define PI 3.14159265358979323846
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
float gaussian(float sigma, float pos) { return (1.0 / sqrt(2.0 * PI * sigma * sigma)) * exp(-(pos * pos) / (2.0 * sigma * sigma)); }
void main() {
vec2 tx = 1. / dimension;
int kernelRadius = 5;
float kernelSum = 0.0;
vec4 col = vec4(0.);
for (int y = -kernelRadius; y <= kernelRadius; ++y) {
vec4 c = texture2D(gm_BaseTexture, v_vTexcoord + vec2(0., y) * tx);
float gauss = gaussian(2.0, float(y));
col += c * gauss;
kernelSum += gauss;
}
vec3 g = col.rgb / kernelSum;
float lambda1 = 0.5 * (g.y + g.x + sqrt(g.y * g.y - 2.0 * g.x * g.y + g.x * g.x + 4.0 * g.z * g.z));
float lambda2 = 0.5 * (g.y + g.x - sqrt(g.y * g.y - 2.0 * g.x * g.y + g.x * g.x + 4.0 * g.z * g.z));
vec2 v = vec2(lambda1 - g.x, -g.z);
vec2 t = length(v) > 0.0 ? normalize(v) : vec2(0.0, 1.0);
float phi = -atan(t.y, t.x);
float A = (lambda1 + lambda2 > 0.0) ? (lambda1 - lambda2) / (lambda1 + lambda2) : 0.0;
gl_FragColor = vec4(t, phi, A);
}

View file

@ -0,0 +1,14 @@
attribute vec3 in_Position; // (x, y, z)
attribute vec4 in_Colour; // (r, g, b, a)
attribute vec2 in_TextureCoord; // (u, v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec4 object_space_pos = vec4(in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,13 @@
{
"$GMShader":"",
"%Name":"sh_kuwahara_ani_pass3",
"name":"sh_kuwahara_ani_pass3",
"parent":{
"name":"kuwahara",
"path":"folders/shader/filter/kuwahara.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"tags":[],
"type":1,
}

View file

@ -0,0 +1,120 @@
#define N 8
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform sampler2D tfm;
uniform vec2 dimension;
uniform float alpha;
uniform int kernelSize;
uniform float zeroCrossing;
uniform float hardness;
uniform float sharpness;
void main() {
vec2 tx = 1. / dimension;
float al = alpha;
vec4 t = texture2D(tfm, v_vTexcoord);
float kernelRadius = float(kernelSize / 2);
float a = kernelRadius * clamp((al + t.w) / al, 0.1, 2.0);
float b = kernelRadius * clamp(al / (al + t.w), 0.1, 2.0);
float cos_phi = cos(t.z);
float sin_phi = sin(t.z);
mat2 R = mat2(cos_phi, -sin_phi, sin_phi, cos_phi);
mat2 S = mat2(0.5 / a, 0.0, 0.0, 0.5 / b);
mat2 SR = S * R;
int max_x = int(sqrt(a * a * cos_phi * cos_phi + b * b * sin_phi * sin_phi));
int max_y = int(sqrt(a * a * sin_phi * sin_phi + b * b * cos_phi * cos_phi));
float zeta = 2.0 / kernelRadius;
//float zeta = _Zeta;
float zeroCross = zeroCrossing;
float sinZeroCross = sin(zeroCross);
float eta = (zeta + cos(zeroCross)) / (sinZeroCross * sinZeroCross);
vec4 m[8];
vec3 s[8];
for (int k = 0; k < N; ++k) {
m[k] = vec4(0.0);
s[k] = vec3(0.0);
}
for (int y = -max_y; y <= max_y; ++y)
for (int x = -max_x; x <= max_x; ++x) {
vec2 v = SR * vec2(x, y);
if (dot(v, v) > 0.25) continue;
vec3 c = texture2D(gm_BaseTexture, v_vTexcoord + vec2(x, y) * tx).rgb;
c = clamp(c, 0., 1.);
float sum = 0.;
float w[8];
float z, vxx, vyy;
/* Calculate Polynomial Weights */
vxx = zeta - eta * v.x * v.x;
vyy = zeta - eta * v.y * v.y;
z = max(0., v.y + vxx);
w[0] = z * z;
sum += w[0];
z = max(0., -v.x + vyy);
w[2] = z * z;
sum += w[2];
z = max(0., -v.y + vxx);
w[4] = z * z;
sum += w[4];
z = max(0., v.x + vyy);
w[6] = z * z;
sum += w[6];
v = sqrt(2.0) / 2.0 * vec2(v.x - v.y, v.x + v.y);
vxx = zeta - eta * v.x * v.x;
vyy = zeta - eta * v.y * v.y;
z = max(0., v.y + vxx);
w[1] = z * z;
sum += w[1];
z = max(0., -v.x + vyy);
w[3] = z * z;
sum += w[3];
z = max(0., -v.y + vxx);
w[5] = z * z;
sum += w[5];
z = max(0., v.x + vyy);
w[7] = z * z;
sum += w[7];
float g = exp(-3.125 * dot(v,v)) / sum;
for (int k = 0; k < 8; ++k) {
float wk = w[k] * g;
m[k] += vec4(c * wk, wk);
s[k] += c * c * wk;
}
}
vec4 outp = vec4(0.);
for (int k = 0; k < N; ++k) {
m[k].rgb /= m[k].w;
s[k] = abs(s[k] / m[k].w - m[k].rgb * m[k].rgb);
float sigma2 = s[k].r + s[k].g + s[k].b;
float w = 1.0 / (1.0 + pow(hardness * 1000.0 * sigma2, 0.5 * sharpness));
outp += vec4(m[k].rgb * w, w);
}
gl_FragColor = clamp(outp / outp.w, 0., 1.);
}

View file

@ -0,0 +1,14 @@
attribute vec3 in_Position; // (x, y, z)
attribute vec4 in_Colour; // (r, g, b, a)
attribute vec2 in_TextureCoord; // (u, v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec4 object_space_pos = vec4(in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,13 @@
{
"$GMShader":"",
"%Name":"sh_kuwahara_ani_pass4",
"name":"sh_kuwahara_ani_pass4",
"parent":{
"name":"kuwahara",
"path":"folders/shader/filter/kuwahara.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"tags":[],
"type":1,
}

View file

@ -0,0 +1,98 @@
#define PI 3.14159265358979323846
#define N 8
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
uniform int kernelSize;
uniform float hardness, sharpness, zeroCrossing;
void main() {
vec2 tx = 1. / dimension;
vec4 m[8];
vec3 s[8];
int kernelRadius = kernelSize / 2;
float zeta = 2.0 / float(kernelRadius);
//float zeta = _Zeta;
float sinZeroCross = sin(zeroCrossing);
float eta = (zeta + cos(zeroCrossing)) / (sinZeroCross * zeroCrossing);
for (int k = 0; k < N; ++k) {
m[k] = vec4(0.0);
s[k] = vec3(0.0);
}
for (int y = -kernelRadius; y <= kernelRadius; ++y)
for (int x = -kernelRadius; x <= kernelRadius; ++x) {
vec2 v = vec2(x, y) / float(kernelRadius);
vec3 c = texture2D(gm_BaseTexture, v_vTexcoord + vec2(x, y) * tx).rgb;
c = clamp(c, 0., 1.);
float sum = 0.;
float w[8];
float z, vxx, vyy;
/* Calculate Polynomial Weights */
vxx = zeta - eta * v.x * v.x;
vyy = zeta - eta * v.y * v.y;
z = max(0., v.y + vxx);
w[0] = z * z;
sum += w[0];
z = max(0., -v.x + vyy);
w[2] = z * z;
sum += w[2];
z = max(0., -v.y + vxx);
w[4] = z * z;
sum += w[4];
z = max(0., v.x + vyy);
w[6] = z * z;
sum += w[6];
v = sqrt(2.0) / 2.0 * vec2(v.x - v.y, v.x + v.y);
vxx = zeta - eta * v.x * v.x;
vyy = zeta - eta * v.y * v.y;
z = max(0., v.y + vxx);
w[1] = z * z;
sum += w[1];
z = max(0., -v.x + vyy);
w[3] = z * z;
sum += w[3];
z = max(0., -v.y + vxx);
w[5] = z * z;
sum += w[5];
z = max(0., v.x + vyy);
w[7] = z * z;
sum += w[7];
float g = exp(-3.125 * dot(v,v)) / sum;
for (int k = 0; k < 8; ++k) {
float wk = w[k] * g;
m[k] += vec4(c * wk, wk);
s[k] += c * c * wk;
}
}
vec4 outp = vec4(0.);
for (int k = 0; k < N; ++k) {
m[k].rgb /= m[k].w;
s[k] = abs(s[k] / m[k].w - m[k].rgb * m[k].rgb);
float sigma2 = s[k].r + s[k].g + s[k].b;
float w = 1.0 / (1.0 + pow(hardness * 1000.0 * sigma2, 0.5 * sharpness));
outp += vec4(m[k].rgb * w, w);
}
gl_FragColor = clamp(outp / outp.w, 0., 1.);
}

View file

@ -0,0 +1,14 @@
attribute vec3 in_Position; // (x, y, z)
attribute vec4 in_Colour; // (r, g, b, a)
attribute vec2 in_TextureCoord; // (u, v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main() {
vec4 object_space_pos = vec4(in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,13 @@
{
"$GMShader":"",
"%Name":"sh_kuwahara_gen",
"name":"sh_kuwahara_gen",
"parent":{
"name":"kuwahara",
"path":"folders/shader/filter/kuwahara.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"tags":[],
"type":1,
}