shader adjustments to account for modulate value

This commit is contained in:
Katharina Ziolkowski
2026-02-01 14:00:21 +01:00
parent 2c8a024528
commit 1120f17202
1766 changed files with 29 additions and 0 deletions
+8
View File
@@ -26,6 +26,9 @@ uniform float heightOffset : hint_range(0.0, 1.0);
// With the offset value, you can if you want different moves for each asset. Just put a random value (1, 2, 3) in the editor. Don't forget to mark the material as unique if you use this
uniform float offset = 0;
// caching color settings to reapply modulate value
varying vec4 modulate;
float getWind(vec2 vertex, vec2 uv, float time){
float diff = pow(maxStrength - minStrength, 2.0);
float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale;
@@ -47,8 +50,13 @@ float noise(vec2 x) {
}
void vertex() {
modulate = COLOR;
vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0);
//float time = TIME * speed + sin(VERTEX.x * noise(VERTEX.xy) * offset);
float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ;
VERTEX.x += getWind(VERTEX.xy, UV, time);
}
void fragment() {
COLOR = modulate * COLOR;
}