#Shader Graph Gerstner Waves

1 messages · Page 1 of 1 (latest)

snow aspen
#

I'm having trouble using shader graphs to implement gerstner waves into my 3D game. I want my waves to move in every direction but they seem to only move back and forth (and not side to side). Does anybody have any ideas on how to fix it? I can post pics if needed

cyan cloak
rugged geyser
#

You need to do something like sin(dot(worldPosition.xz, windDirection) * frequency + speed * time) * amplitude.
I'm guessing you're probably missing the dot(worldPosition.xz, windDirection) and are just doing sin(worldPosition.x * frequency + time) or something

#

windDirection should be a normalized 2D vector pointing in the direction you want the waves to move. You can also calculate it based on a single 'angle' between 0 and 1, using something like "float2 windDirection = float2(cos(radians(windAngle * 2 * pi), sin(radians(windAngle * 2 * pi)));"