top of page

Shaders

Fluffy Cloud Shader and Stylized Water Shader
 

cloudvertex.png
cloud.png

Although I had experience with Blueprint, I decided to follow this tutorial to familiarize myself with Unity Shadergraph. Basically, it is a vertex animation shader, using some noise map to drive all the vertex moving in some way. I realized that more polygon would give a finer look but I do consider the performance. In this case, I reduced the polycount to fit our project.  

Screenshot 2023-02-17 224512.png

In order to drive the vertex using a noise mask, I need to project the noise on the object's UV space. In this case, I used the world position vector and then rotate 90 degrees about the x-axis. 

1.png

Then, I create the noise mask using gradient noise. To get some variation, I offset two noise maps by adding a time node to one of them. Then I add their value and divide to get the mean value. Then I used saturate(which I think is like a clamp node) to eliminate values under 0 or above 1. 

This is the thrid noise mask I overlayed under the previous two. I scaled up the noise so that it could be used as a foundation of the noise. The previous two would be the variation.

1.png
1.png

Here, I added the noise mask together. This map is where the magic happens. I would drive the vertex position, the base color, and the emission color using this animated noise mask.

For the base color, the fresnel node did all the tricks. It gives a gradient mask from the center to the edge which I utilized with the noise mask to color my mesh.

By subtracting scene depth from the screen position I can get an easy depth fade from the surface to the bottom. The smooth step determined where I would like to end the fading effect.

1.png

Simple Water Shader
 

e68815303e64f5c9cd7051fec9c5c3a.jpg

I was inspired by the cloud shader and then created this stylized water shader using the useful concepts I learned from the cloud shader. 

1.png

I am using the same technique from the cloud shader to get the depth fade and the movement on UV

1.png

This time I made the movement a function node so that I can reuse it in the graph. Once I plug it into noise, the animated noise mask pops up again. Then, I used a step node to compare the noise mask with the depth fade value to create the foam and blinking rim. Finally, I lerp in the color.

1.png
bottom of page