I want to add snow to a mesh, so I need to add the second texture based on the global z of the scene, i .e . it should only cover the top of the object. How can this be done? Is it possible to say "if this normal is along the z axis add this texture?"
The Normal link in a Geometry node is dedicated for this purpose:
In the Node Editor, add the Geometry node, link the Normal to a Separate XYZ node, then use the Z link for a factor in a mix node. In my example I added a Color Ramp node to control This factor, check the image below for the nodes setup, and the Gif to see how you can use the Color Ramp node to control the effect.
You can do that using a cross product with the Z axis.
The cross product of (0, 0, 1) and (0, 0, 1) is null. So the output (2) can drive a mix shader between the snow (horizontal part) and the walls (non horizontal parts).
If the object has smooth shading, the result is different. To handle this, I added this "greater than" comparison.
The best way to do this is by using "UV Project" Modifier. It allows you to control the texture orientation based on the camera.
Try this link for details