Skip to main content
GameDev.net gamedev.net
🔒 Locked

Calculating normals...

Started by elis-cool Dec 23, 2002 at 2:41 AM 2 replies 300+ views
Original Post
elis-cool
elis-cool
Ok, I understand what normals are etc, but im just not sure on how to calculate them or what their actual values are... Basicly I want to know what would the vertex normals be for a qaud with vertices at [x,y,z]: [0,0,0] [0,20,0] [20,0,0] [20,20,0] ? would they all be 1.0,1.0,1.0 or something??
[email=esheppard@gmail.com]esheppard@gmail.com[/email]
iodine23
iodine23
0,0,1 or 0,0,-1. The normal is perpendicular to the surface. Your surface is in the xy plane so its normal will be in the z-axis. You should be able to figure that out logically.

Mathematically, the normal of two vectors is the cross product of those two vectors. In your case, you can use the vectors [0,20,0] and [20,0,0] for one of the corners. The cross product yields [0,0,400] or [0,0,-400] depending on the order of the vectors.

If you normalize the vectors to [0,1,0] and [1,0,0] the cross product becomes [0,0,1] or [0,0,-1] depending on the order of the vectors... there''s your normal.
elis-cool
elis-cool
normalize means what?
[email=esheppard@gmail.com]esheppard@gmail.com[/email]
Gladiator
Gladiator
Normalizing a vector is the process of scaling a vector''s length to 1. In order to do that, you have to divide each of the vector''s components (x, y, z) by the current length of the vector.

Normalizing is the process. A normalized vector is called a Normal.

If you calculate the length/magnitude of a normal you will end up with 1.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.