Jump to content
  • Advertisement
Sign in to follow this  

Bending normals 45 degrees

This topic is 3896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!