Part I: Water Shader Set-Up
There ended up being tons of really helpful resources for making stylized or simple water shaders. I did bring Adam Homoki's really complicated cartoon shader into the project and took some elements from his set-up, including his math for the Gerstner waves/world displacement, plus a few texture maps and material functions.
World Displacement
This uses the Cartoon water shader's Gerstner waves to calculate world displacement. It's a lot of math and cosine stuff that I don't fully understand, but I think it adds a lot of dynamism to the shore since it creates a more radically different surface than just a sine function.
Base Color with Depth Fade
I watched a YouTube video that used depth fade, and thought it would be useful in transitioning the ocean and the shore. It uses a blend overlay node and lerps using a depth fade node as a mask.
Fresnel Color Transition
This creates a change in color for distant water based on the viewing angle and makes the water a little less flat-looking.
Normals
Something else I took from Adam Homoki's shader: his normal blend material functions and normal maps. I could probably honestly do without them and use a simpler normal set-up if I needed to.
Edge Foam
This I got from a nice and simple YouTube video Nick shared. It needs Distance Fields turned on in the Project settings, since it uses those to judge where to generate noise.
Roughness
Played around with this quality, just trying to make the sun shining on the water surface a little less weird-looking. It uses a fresnel, and I'd like to work on the transition a little, although the hard edges might contribute to the stylized look since it makes it look a little cel-shaded.
Edge Fade
Uses the same node as the edge foam to soften the transition between the island and water. The issue is that it also does it for any objects that may be floating in the water, and you can see down below the water plane.
Sea Foam
These maps were taken from Adam Homoki's shader. It looks at the world position to tell the height of a wave, and if the wave is high enough, it applies the sea foam mask.
Foam Sparklies
This is an emissive quality that uses the same mask the sea foam uses to limit the location of the shiny bits. The two maps pan, and whenever their pure-white spots overlap, the If node lets it through and it comes out as an emissive spot.
No comments:
Post a Comment