Jump to content
  • Advertisement

Archived

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

James Trotter

Normals for quad strips...

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

Ok, I''m drawing Quad Strips in my program, and I''m specifying the normals for them, but what I''m wondering about is if I can do it like this: glNormal3f(Normal[0].x, Normal[0].y, Normal[0].z); glVertex3f(Vertex[0].x, Vertex[0].y, Vertex[0].z); glVertex3f(Vertex[1].x, Vertex[1].y, Vertex[1].z); glVertex3f(Vertex[2].x, Vertex[2].y, Vertex[2].z); glNormal3f(Normal[1].x, Normal[1].y, Normal[1].z); glVertex3f(Vertex[3].x, Vertex[3].y, Vertex[3].z); Or if I just use the same normal for the whole Quad Strip... Any help is greatly appreciated!

Share this post


Link to post
Share on other sites
Advertisement
Rememer that OpenGL is a (finite) state machine. So normal will be used for all vertices processed until you send a new one.

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
Yes, thank you DarkWing, but I''m already aware of that. But what I wanted to know is if the second normal counts for the second quad... Because of that after the three first vertices, every new vertex specifies a new quad...

Share this post


Link to post
Share on other sites
I think each normal counts for only the vertex not a whole quad. You can then have a quad with 4 different normals if you want smoother lighting.

Share this post


Link to post
Share on other sites
Thank you Xiros! But is there really a way to calculate normals per vertex?? If there is I would really like to know. So please, if you have any tutorials, references, etc...

Share this post


Link to post
Share on other sites
a vertex has no normal, you can only get the normal from a plane (3 points). to do that just take the cross product of two vectors (two sides of a triangle).

Share this post


Link to post
Share on other sites
If you want your object to appear smooth (e.g. a sphere), then you need to calculate an average normal from the vectors of the neighboring polygon edges.

If you want it to appear angular (e.g. a cube) then for each vertex have it calculated as the cross product of two of the polygons edges.

I have not done much 3D, and one thing I am curious about is how the artist controls the normals in a model - I have made a 3d model before but at no point did I seem to have direct control of the vertice normals, so how could the program possibly know what was supposed to be a smooth edge and what was supposed to be a angular edge?

One way I thought is that if it is a large angle (say 150 degs)between edges then the normal would be averaged, otherwise it is normal to the polygon face, is this correct?

Share this post


Link to post
Share on other sites
quote:
Original post by xiros
I think each normal counts for only the vertex not a whole quad. You can then have a quad with 4 different normals if you want smoother lighting.


I am possibly mistaken here, but..If you are using index buffers, then you can only have one averaged normal, and all the faces surrounding it will be smooth, and even if you weren''t, you would set all the vertice normals to the same direction to make it appear smooth (how exactly this would be done without an index buffer I dont know).

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!