top of page
Sometimes when writing shader code, it can be important to mask off different effects. This can be done many different ways, but one of the common ways is to use world space coordinates.
In an Up-Vector Masking shader, one masks an effect based on whether the normal direction is facing up or not. To manage this feat is actually quite simple:
By taking the dot product of a direction and the normal direction, one can calculate the relationship between those two directions. The return value would lie between -1 and 1, and this would allow you to know whether the normal is facing up or down.
You could then use this value to interpolate between Normals, Color, Specularity, Textures, or any other effect you want to rely on the world's up vector. In this case, I wanted to create a snow shader.
bottom of page