top of page

Create Your First Project

Start adding your projects to your portfolio. Click on "Manage Projects" to get started

Stylized Water Shader

Unity Shader

This is a stylized water unity shader used for demonstration of NPR style cartoon water.
I tried to simulate the color, foam, wave to adopt it in my own game demo.

The basic idea of its shaderlab code is to:
(1) Get the depth texture from the camera, and compute the depth of water
(2) Compute the color of water according to the depth under it
(3) Use perlin noise to add waves to the water
(4) Add a threshold of depth to foam, in which that shoreline foam can be implemented (the shallower the depth, the easier to generate foam). Moreover, use the normal of objects under water to determine the depth, so that the foam size can be consistent(for gadgets in water)
(5) Add animation to water by adjusting the UV offset
(6) Add distortion to water by adding a distortion map
(7) Make the water transparent by normal blending
(8) Make the foam color changeable by alpha blending
(9) Use smoothstep() for anti-aliasing

***You can click on the video below to view its effect***

bottom of page