this time i'm breaking down my water shader!
#gamedev #indiedev #shaders #madewithunity
there are lots of good stylized water tutorials out there, like this one by @minionsart : so i'm just going focus on what's different
the shader takes two scrolling normal maps and blends them together in a way that better preserves detail than just learping or adding them.
the reflection is code is just copied from unity's standard shader
we can get a texture with everything that has already been drawn to the screen using a grab pass: docs.unity3d.com/Manual/SL-Grab…
now we can sample from this texture using distorded uvs based on our normals
more detail in there, but basically these are sine waves that are pinched towards the peaks so you get some nice undulation on the surface
here i just have particles write the ripple height into the blue channel and then use that heightmap to deform the verts and normals of the water