EP 6: Once we’ve made a rock, we usually want to be free and efficient to continue making mossy or snow-covered rocks. At this point we need to mix the ambient materials.
Principle: Before connecting to the end node, use the Lerp node to set the difference between the two Texture samples. The difference effect is determined by the Alpha property.
How to obtain Alpha:
1. Transform the tangent space to the world space using the RGB value of one of the normal maps.
2. Take the Z value of the normal line (Mask(B)), Add a number and then multiply. Clamp limits are used to prevent overrange. 3. Connect the result to the Alpha port of the two Lerp nodes:The closer the normal Z value after treatment is to 1, it shows moss. The closer you get to 0, the rock is shown.
EP 7: Shader performance can be optimized through shader complexity view, number of shader commands, and real machine testing. 1.Pow node has high cost performance.
2. Squeeze as many textures into one Texture as possible through the color channel to greatly improve performance.
3. Perform repeated operations at once.