How Unity's ShaderGraph achieves snow effect

Preface

In some special scenes, such as ice and snow, we often add some snow effects to surrounding objects. If we directly add snow to the model, we will not be able to express other weather environments more flexibly, such as switching between spring, summer, autumn and winter. So generally we use Shader to express this kind of demand.
As shown in the figure below:
Insert image description here

key node

NormalVector: Provides access to the normal vector of a mesh vertex or fragment. You can use the Space drop-down parameter to select the coordinate space for the output values.
Insert image description here
GradientNoise: Generates gradient or Perlin noise based on input UVs. The amount of noise generated is controlled by the input Scale. In terms of performance cost, gradient noise nodes can be slightly more computationally intensive than sampled texture maps. Since UV values ​​are used as seeds for noise generation, you can offset, scale, or distort UV values ​​to generate different noise patterns.
Insert image description here

principle

The principle of the snow effect is: get the normal vector of the object surface, calculate the upward position, superimpose a layer of white on it, and even modify its vertices to make the snow show its thickness.
Here I used the Noise noise map to randomize the snow, so that the shape of the snow will be more random, not too regular, and look fake.

final connection

Insert image description here

Parameter panel

Insert image description here

Guess you like

Origin blog.csdn.net/qq563129582/article/details/133917413