Jump to content
  • Advertisement
Sign in to follow this  
silvia_steven_2000

How to specify the normals of a cube ?

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

Advertisement
Vertices can only be shared if the entire vertex matches. This still reduces a cube (which is a fairly worst-case object) down to 24 vertices instead of 36 (two triangles on the same face can share two vertices, so 4 vertex * 6 faces).

Share this post


Link to post
Share on other sites
As Namethatnobodyelsetook said, you'll have to increase the number of vertices in order to get so called "sharp" lighting.

A cube isn't the best example, but in a lot of cases, people use "smoothing groups" so as to still share common vertices but have as little impact on lighting as possible. I think this gives a much better result when I write up terrain renderer's.

In the context of your cube, each of your 8 vertices is used by 3 different faces; if you were to calculate face normals for each of those, add them together, re-normalize (to maintain unit length) that would be a "smoothed normal". For a cube, you'd end up with an almost sphere-like shading pattern but with sharp sillouettes [smile]

hth
Jack

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.

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!