-
-
Save odasatoshi/8fb553dc73af612fceea1ba41eee2b19 to your computer and use it in GitHub Desktop.
Madmapperで縁取りをするためのスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*{ | |
"CREDIT": "ODA Satoshi", | |
"DESCRIPTION": "Trimming object edge", | |
"TAGS": "Trimming", | |
"VSN": "1.0", | |
"INPUTS": [ | |
{ "LABEL": "Line Width", "NAME": "line_width", "TYPE": "float", "DEFAULT": 0.03, "MIN": 0.0, "MAX": 0.5 }, | |
{ "LABEL": "Speed", "NAME": "mat_speed", "TYPE": "float", "MIN": 0.0, "MAX": 2.0, "DEFAULT": 1.0 }, | |
{ "LABEL": "Link to global BPM", "NAME": "mat_bpm_sync", "TYPE": "bool", "DEFAULT": 0, "FLAGS": "button" }, | |
{ "LABEL": "Color/Tint", "NAME": "mat_tint", "TYPE": "color", "DEFAULT": [ 1.0, 1.0, 1.0, 1.0 ] }, | |
], | |
"GENERATORS": [ | |
{"NAME": "mat_animation_time", "TYPE": "time_base", "PARAMS": {"speed": "mat_speed", "speed_curve":2,"bpm_sync": "mat_bpm_sync", "link_speed_to_global_bpm":true}}, | |
] | |
}*/ | |
vec4 materialColorForPixel( vec2 texCoord ) | |
{ | |
vec2 uv = texCoord; | |
vec2 p = uv - vec2(0.5,0.5); | |
vec4 color = vec4(0.0, 0.0, 0.0, 1.0); | |
float mat_time = mod(mat_animation_time,8); | |
if (mat_time < 1.0){ | |
if ((uv.y < line_width) && uv.x < mat_time){ | |
color = mat_tint; | |
} | |
} | |
if (mat_time >= 1.0 && mat_time < 2.0){ | |
if ((uv.y < line_width)){ | |
color = mat_tint; | |
} | |
if ((uv.x > 1 - line_width) && uv.y < mat_time - 1.0){ | |
color = mat_tint; | |
} | |
} | |
if (mat_time >= 2.0 && mat_time < 3.0){ | |
if ((uv.y < line_width) || (uv.x > 1 - line_width)){ | |
color = mat_tint; | |
} | |
if ((uv.y > 1 - line_width) && 1 - uv.x < mat_time - 2.0){ | |
color = mat_tint; | |
} | |
} | |
if (mat_time > 3){ | |
if ((uv.y < line_width) || (uv.x > 1 - line_width)|| (uv.y > 1 - line_width)){ | |
color = mat_tint; | |
} | |
if (uv.x < line_width && 1 - uv.y < mat_time - 3.0){ | |
color = mat_tint; | |
} | |
} | |
return color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment