June 2018
Intermediate to advanced
392 pages
8h 57m
English
The second effect of this shader alters the geometry to simulate the accumulation of snow. Firstly, we identify which triangles have been colored white by testing the same condition used in the surface function. This time, unfortunately, we cannot rely on WorldNormalVector() as the SurfaceOutputStandard structure is not yet initialized in the vertex modifier. We use this other method instead, which converts _SnowDirection to object coordinates:
float4 sn = mul(UNITY_MATRIX_IT_MV, _SnowDirection);
Then, we can extrude the geometry to simulate the accumulation of snow:
if (dot(v.normal, sn.xyz) >= _Snow){ v.vertex.xyz += (sn.xyz + v.normal) * _SnowDepth * _Snow;}
Once again, this is a very basic effect. You could use a ...