Dan_Ritchie

08-01-2014, 01:30 PM

In the node editor, I would like to create a random normal that points in any direction that is within the hemisphere of the surface normal.

It's easy enough to calculate a random normal.

To make it face only away from the polygon of the spot being sampled, you would usually calculate it in world space, and eliminate or abs() anything with a negative y value, then transform it into the space of the normal. That's where I get lost.

The node editor has a transformation matrix, but I don't know where to start.

How do you transform from world space into normal space?

It's easy enough to calculate a random normal.

To make it face only away from the polygon of the spot being sampled, you would usually calculate it in world space, and eliminate or abs() anything with a negative y value, then transform it into the space of the normal. That's where I get lost.

The node editor has a transformation matrix, but I don't know where to start.

How do you transform from world space into normal space?