Jump to content
  • Advertisement

Archived

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

anakin_skywalker

About normal vectors and lighting

This topic is 5654 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...I know that we have to define the normal vectors of a polygon in order to use lighting. However I have problems understanding when to use vertex normals, and when to use surface normals. Also, I''ve noticed that when i enable lighting and I draw flat polygons, the polygon is lit even though i didn''t called glNormal() in any of its vertices..I would like to know why this happen.? I''ll really appreciate your replies!!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
(--)..

Share this post


Link to post
Share on other sites
quote:
Also, I''ve noticed that when i enable lighting and I draw flat polygons, the polygon is lit even though i didn''t called glNormal() in any of its vertices


OpenGL is a state machine. Things stay the way they are until you change them.Once you set up lighting, OpenGL will read it''s memory to see what you last set as the normal. If you haven''t set any normal yet, the memory it reads won''t have been initialised with anything specfic, so the normal it retrieves will basically be a random number.

quote:
However I have problems understanding when to use vertex normals, and when to use surface normals


This depends what sort of shading you want. If you use vertex normals you get goraud shading, where the shade is spread nicely across the surface. This is good for hi-polygon models and things like terrain, because it gives the impression that the gradient on the ground is constantly changing.

face normals are better for something with sharp edges or large flat faces like a cube.

But you can you either type for anything you want... just choose what you think looks best.

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.

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!