shader effect snow

Snow direction and normals dot product, if the value is greater than the thickness of the snow change the color of the fragment of the output color Snow

在Properties中添加:
_SnowColor(“snow color”,Color) = (1,1,1,1)
_Snow(“snow level”,Range(0,1)) = 0.5
_SnowDir(“snow dir”,Vector) = (0,1,0)

定义:
float4 _SnowColor;
float4 _SnowDir;
float _Snow;

Prior to the determination fragment shader output color:
IF (DOT (worldNormal, _SnowDir.xyz)> Lerp (. 1, -1, _Snow))
{
Color.rgb = _SnowColor.rgb;
}
return Color;

We can do simple snow effects. By thus controlling the value of the control _SnowDir snow direction, i.e., in which direction the need of snow.

Published 22 original articles · won praise 0 · Views 372

Guess you like

Origin blog.csdn.net/weixin_43839583/article/details/104094335
Recommended