- Added a indev magician model. - Added a screen shader. - Also updated the project to 4.7. - Added new custom dev texture.
53 lines
1.2 KiB
Plaintext
53 lines
1.2 KiB
Plaintext
shader_type canvas_item;
|
|
|
|
global uniform float time;
|
|
|
|
const int SCRIBBLES = 4;
|
|
|
|
uniform sampler2D albedo_texture;
|
|
uniform bool use_linear_color_space = false;
|
|
uniform float scribble_switch_speed = 3.0;
|
|
uniform float scribble_intensity = 0.05;
|
|
|
|
group_uniforms ScribbleTextures;
|
|
uniform sampler2D scribbles_1 : hint_normal;
|
|
uniform sampler2D scribbles_2 : hint_normal;
|
|
uniform sampler2D scribbles_3 : hint_normal;
|
|
uniform sampler2D scribbles_4 : hint_normal;
|
|
|
|
|
|
void fragment() {
|
|
// Called for every pixel the material is visible on.
|
|
float wrapped_time = mod(time * scribble_switch_speed, float(SCRIBBLES));
|
|
vec2 uv = UV;
|
|
|
|
vec3 scribbles;
|
|
switch (int(wrapped_time))
|
|
{
|
|
case 0:
|
|
scribbles = texture(scribbles_1, uv).rgb;
|
|
break;
|
|
case 1:
|
|
scribbles = texture(scribbles_2, uv).rgb;
|
|
break;
|
|
case 2:
|
|
scribbles = texture(scribbles_3, uv).rgb;
|
|
break;
|
|
case 3:
|
|
scribbles = texture(scribbles_4, uv).rgb;
|
|
break;
|
|
}
|
|
|
|
uv.x += (scribbles.x - 0.5) * scribble_intensity;
|
|
uv.y += (scribbles.y - 0.5) * scribble_intensity;
|
|
|
|
vec4 tex = texture(albedo_texture, uv);
|
|
|
|
if (use_linear_color_space)
|
|
tex.rgb = pow(tex.rgb, vec3(2.0)); // sRGB to linear
|
|
// linear to sRGB: tex.rgb = pow(tex.rgb, vec3(1.0 / 2.2));
|
|
|
|
COLOR = tex;
|
|
//COLOR.rgb = scribbles;
|
|
}
|