Jump to content
  • Advertisement
Sign in to follow this  
Lord_Danny

Direction of vectors and normals?

This topic is 2510 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 guys,

Trying to calculate the normal, which I have the equation for, but the thing is I don't understand how a Vector in 3D space knows which direction it is pointing to? Because I thought a vector is just a point in space, so how can we determine which way a vector is facing as I need it for calculating Normals to do all the lighting effects and so on?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
When we talk about the direction of a vector we usually mean the direction that points from the origin (0,0,0) to the position the vector denotes. So if the y direction is "up" then (0,1,0) is a vector that is pointing up.

Share this post


Link to post
Share on other sites
In simple words first: A vector is the direction thingy, not the point.

We call a set of things a vector space if we can add them, subtract them and scale them, and these operations satisfy some reasonable properties. The set of points in 3D space are not a vector space, and you shouldn't think of them as vectors. The translations in 3D space (e.g., move 1 unit up) can be added, subtracted and scaled, all the right properties are satisfied and they are therefore vectors.

You can pick a particular point in 3D space, call it the origin and then you can refer to a point by the vector that has to be applied to the origin to get to the point.

This is the way I think about these things, and it makes things very clear. For further reading: http://en.wikipedia....ki/Affine_space

Share this post


Link to post
Share on other sites
To expand on what japro said, a "vector" is simply 3 numbers. When that vector is used as a point, the numbers represent the offset on each of the 3 axes from (0,0,0). When it is used as a normal, the numbers represent a direction from (0,0,0).

Vectors are additionally stored with a 4th component, w. For a point, w = 1. When you multiply a point vector by a translation matrix, that point is translated. For a normal, w = 0. When you multiply a normal vector by a translation matrix, it is not translated (because the translation is multiplied by w).

Share this post


Link to post
Share on other sites
The mathematician in me feels uncomfortable with the fuzzy language that others are using. On the other hand, it's probably good enough for game development and I probably should refrain from trying to argue with everybody about things that ultimately won't make much difference in your code.

I should find some pills to take when this happens. smile.png

Share this post


Link to post
Share on other sites

The mathematician in me feels uncomfortable with the fuzzy language that others are using. On the other hand, it's probably good enough for game development and I probably should refrain from trying to argue with everybody about things that ultimately won't make much difference in your code.

I should find some pills to take when this happens. smile.png


I know how you feel, unfortunately I have way to much experience getting blank stares when I explain things "technically" correctly (the only real kind of correct wink.png )

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!