Add //!steps directive, some code cleanup, updated README & examples

This commit is contained in:
ChaoticByte 2025-01-06 22:11:53 +01:00
parent 1b87cafb13
commit 1d9f838668
No known key found for this signature in database
7 changed files with 89 additions and 50 deletions

View file

@ -1,13 +1,20 @@
shader_type canvas_item;
//!steps 9
//!load ./swamp.jpg
const float strength = 0.1;
const float strength = 0.01;
void fragment() {
float v;
if (STEP % 3 == 0) {
v = COLOR.r; // 3 times
} else if (STEP % 3 == 0) {
v = COLOR.g; // 3 times
} else {
v = COLOR.b; // 3 times
}
vec2 uv = UV;
float b = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
uv.x = mix(uv.x, b, strength);
uv.y = mix(uv.y, b, strength);
uv.y -= v * strength;
COLOR = texture(TEXTURE, uv);
}