Greetings Everyone!
I just recently started learning Computer Graphics and shaders, I wanted to challenge myself a bit after seeing an anime style ocean shader made in blender, wanted to try re-doing this shader myself in unity using Shader Graph.
So I started by making a bunch on noises and adding them together, animating them using time so that I displace the vertices y position.
I applied 3 noises, the small one is just to make tiny pumps,
the WaveNoise1 uses Sin wave with 4 octaves, the WaveNoise2 uses e^Sin, also 4 octaves.
it looks fine so far (I feel like I over-complicated it but it still looks nice).
but now the issue, idk how to color this in an anime style or toon way.
tried a bunch of methods but mostly fails due to it feeling weird and not showing shadows at all (probably cuz of the normals).
this is the style I’m trying to achieve: Wave video on Twitter (X)
Here are screenshots of what my wave looks like and my ShaderGraph.
Should I make the noises different to achieve a better look and how?
and how do I color this?
I love your reference video! Very cool. One way to get that effect would be to start with the Y component of the vertex normal in world space - which is white when the normal is facing up and black when the normal is facing horizontally. You can use a bit of math - maybe using the Remap node - to adjust the sharpness of the gradient and the blend. Then use that result to Lerp between a light blue and a dark blue color.
I tried doing this where I used a Normal Vector node in object space, did a dot product with (0, 1, 0)
to try to get the normal angle of each vertex with world up, but that didn’t work as I expected.
Am I supposed to recalculate the normals myself after the vertex displacement? if so how do I do this?
Yes, when moving vertices around, if you want lighting to continue to work correctly, you also have to adjust normals. This can be a little complex and there are many different ways of doing it. The Feature Examples Shader Graph sample that’s available from the Package Manager has an example subgraph called Gerstner Wave that adjusts both vertex positions and normals - so you could take a look at that example to see how it’s done. There’s a small amount of documentation on it here.
What I get so far is something like this:
I used in my MultiWater asset package in AssetStore