Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RonnyK

Normals

This topic is 6230 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

What is a normalized vector, why are they used? When the direction for the normal is entered, should the position be relative to the 0, 0, 0 co-ordinate, or does it work in some completly different way? And umm.... do I have to know anything else to get those normals working?

Share this post


Link to post
Share on other sites
Advertisement
Vectors are a direction, not a coordinate - so they are always relative to 0,0,0. Normalised vectors are a vector divided by its length - ie. the normalised vector has a length of 1. Use pythagoras to do this. For example, if you have a 2d vector vy,vx to get the length you have to do this: l = sqrt((vy*vy)+(vx*vx)). To normalise the vector, you just do: vx/=l; vy/=l;

Hope this helps!

Share this post


Link to post
Share on other sites
code snippet.

  
D3DXVECTOR3 normal;
D3DXVECTOR3 polyvecs[3];

// to normalise


D3DXVECTOR3 vec1,vec2;

vec1 = polyvecs[1] - polyvecs[0];
vec2 = polyvecs[2] - polyvecs[0];

// cant remember the actual function,

// its just a simple cross product.

D3DCrossProduct(normal,vec1,vec2);

// normalise in the sense to remove anomolies.

Normalise(normal);





{ Stating the obvious never helped any situation !! }

Share this post


Link to post
Share on other sites

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