PDA

View Full Version : Need help in node editor. Any develpers on here?

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?

RebelHill
08-01-2014, 02:08 PM
This'll explain the basics of spaces in the node editor... https://www.youtube.com/watch?v=yXk8c1w7rNo&index=10&list=PL1C4072533A16B807

Beyond that there isnt a "normal space", only the object space, and world space. What you'd want is to take the normal, from an objects spot info, and simply transform it by a random amount in each axis, constraining/clamping the result to be within +-90 degs in any given axis. There's a few ways you could approach it, I guess... either doing a direct co-ord transform, or perhaps by using the HPB to matrix node (generating a random HPB input within +- 90 degs), and use that output as a transform matrix onto the normal vector.

Dan_Ritchie
08-01-2014, 03:39 PM
Tangent space I think is the word I was looking for.