Here is a quick tip of one in many ways on how to create a mask based on the angle of your object in relation to your camera. This trick is particularly useful for when you are using cards to fake light shafts, glow and other things.

The idea is to first find the relationship between the object, the world and the camera. Transforming the vectors from world space in to local space is really important for it to work no mater where the object is (now that I look at it, I have the feeling the TransformVector node after the ObjectOrientation could be removed).

After it is just a mater of manipulating those vectors to achieve the desirable result.

The Aboslute Value node is transforming the gradient that goes from right side to the left side of the object in to a gradient that starts from the front and goes to both sides equally.

*example of how Abs is affecting your mesh, the sides of the square being the left and right angle of your mesh and the center being the front*

If for some reason you want the sides masked but not the top, remove the CrossProduct node and add OneMinus instead.

That should give you the mask you want, now you can control how much to the sides and how strong you want the effect to be.

*simple way to manipulate a gradient*

If you only want your geo to fade from the top all you need to do is isolate the blue channel (Z) and use it as your mask.

Some people provided me some real useful feedback on how to improve the workflow and make it faster:

0,0,-1 in camera space means pointing towards the camera and the ObjectOrientation points to the object’s z+ axis. If you get the dot product of both, you’ll get 1 if the object’s z+ is pointing towards the camera, 0 if it’s perpendicular and -1 if it’s pointing away.

Abs turns the negative values positive, and Saturate clamps them between 0-1 so you can use either depending on what you want.

S-ed :

Shortest version of what your second example was in the first post:

if you use dot product with exposed vector 3 parameter, you can then specify which axis to use in material instance per case:

Feel free to join the discussion at the polycount forum.