#### Archived

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

# Normals

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

## Recommended Posts

Hey, im 12, and im learning OpenGL. I have created a pyramid and now im adding light, but i cant figure out how to calculate the normals of the face. If you could help that would be great. After i get my awnser, Moderator, you can delete this, so it doesnt take up bandwidth. ______________________________ Quantum CEO of Quantum Rebound Software Website Up Soon

##### Share on other sites
Hi,

Given three points you can compute the normal.

If P1, P2, and P3 are points on the plane (the side of your pyramid) you do this:

P1P2 Cross P1P3 = normal

If you aren''t sure what the Cross Product is you should look through the articles on this site, I''m sure it''s there.

Bye.

##### Share on other sites
http://home.planet.nl/~woute890/normals.html

##### Share on other sites
Ok, Another question: Is it better to precalculate and then just hard code the normals into my objects and rendering, or should there be some function at startup that finds all the normals and stores them?

______________________________
Quantum
CEO of Quantum Rebound Software
Website Up Soon

##### Share on other sites
12 years old? Do you know what a cross product is? Not like its hard stuff, they just don''t introduce topics like that until high school usually.

##### Share on other sites
Pre-calculating normals is worth doing for most objects. If you know that the LOCAL vertex coordinates are not going to change thoughout the program then pre-calcuate them. For the triangle this is worth doing as all you will probably be doing with it is moving and rotating it.

If the vertex co-ordinates are going to be easily changable then you should calcuate normals in the program. This is done if you are going to rescale the model, warp the models shape or don''t know all of the coordinates yet (terrain). I don''t think you''ll be getting up to all that for a little while yet.

What you perhaps should do is create a small program that works out normals for you (maybe a simple dos or shell program). You can use it to pre-calcuate the normals for your model while still letting you learn the code that can be adapted later for terrain and the likes.

##### Share on other sites
Ebony: No not yet
AN_D_K: Good idea, ill try that. I just barely got the equation from a friend, and i put it in excel.

______________________________
Quantum
CEO of Quantum Rebound Software
Website Up Soon

##### Share on other sites
That being said, I actually use a spreadsheet to do all my my normals because I''m lazy.

...also, I never learnt Cross Product when I was 12. Actually, I learnt when I was 18 after doing Maths throughout my academic career. Do the US really do them when their 12? Seems a bit useless to people who don''t want anything more than good basic skills outside of Maths related fields.

##### Share on other sites
AN_D_K: No no no, people in the US do not learn cross products or even matrices when they''re 12. I''m 16 now (in Alg 2), we just learned about matrices (we being the class, being a programmer I''ve known for awhile) and we haven''t touched vector math.

He''s probably making an effort to learn this stuff on his own, as I''m sure many (myself included) did.

##### Share on other sites
Oh, I just thought it was the UK education system dumbing down again. Thinking about it though, our government are planning on scrapping proper Maths as a compulsory subject anyway to make way for "citizen maths" (as in how many "euros" do I have left if I...).

1. 1
2. 2
3. 3
Rutin
21
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633654
• Total Posts
3013171
×