Bending normals 45 degrees

Started by
-1 comments, last by spek 16 years, 2 months ago
Hi, A short while ago I asked about creating new normals by bending an original normal 45 degrees. I did'nt fix the problem though, so I'd like to ask it again. I need to take multiple samples from a cubeMap texture. Normally I take only 1, depending on the (world) normal. But I need to gather some extra data around that point. I think the best way to do this, is bending the normal 45 degrees (when looking aside from it). I'd like to do this 4 times (or maybe more). So if you look at a top view of the original normal, you get something like this:

N = original normal, from right above
1,2,3,4 are bended normals, there is 90 degrees between them when looking at top
     2 
     |
  1--N--3
     |
     4
Someone at a non-programming math forum helped me: >>If you 'move' all your vectors (you can always 'move' them back later) so that, looking at an xyz-coordinate system (a 3-d coordinate system) the vector n runs from the origin along the positive z-axis (ie. n = k), then unit vectors 1, 2, 3 and 4 (you can re-length all vectors later) are: 1 = i/sqrt{2} + k/sqrt{2} 2 = -i/sqrt{2} + k/sqrt{2} 3 = j/sqrt{2} + k/sqrt{2} 4 = -j/sqrt{2} + k/sqrt{2} i, j, k are the usual unit vectors in the x, y and z directions. << How to translate that into a shader? I think I understand the last part, but how do you 'move' a vector along with the positive Z axis? Keep in mind that the original normal can point into any direction. Greetings, Rick

This topic is closed to new replies.

Advertisement