Jump to content
  • Advertisement
Sign in to follow this  
kdworld

Shading model Question.

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

Hello Friends, In my project i need to find the shading model for the 3d object mesh. The Mesh can contain a sphere and box (take this as an example), As we know sphere should be renderd with smooth shading(interpolate), and box should be drawn using Flat shading.. But i have only one input mesh ,which does not have this shaing information.. I guess i need to group the mesh depending upon the smoothing angle . Are there any standard method exists or any other nice ideas ? Thanks, KD

Share this post


Link to post
Share on other sites
Advertisement
This particular bit of shading information, can be stored as proper vertex normals, which should be part of most 3D meshes.

Share this post


Link to post
Share on other sites
Thanks pismakron.

Do you know whether .3ds have this information ? I am dealing with 3ds format.

Share this post


Link to post
Share on other sites
To be quite honest I don't know anything about the .3ds format. But I know that with the Lightwave format you had to calculate vertex normals from adjacent surface normals. Which was annoying.

Share this post


Link to post
Share on other sites
3DS doesn't contain precomputed normals. Instead it contains smoothing groups - and you need to compute the normals on your own. This is not difficult, but you should include some type of spatial sorting to be able to find vertices close to each other quickly. Otherwise you'll end up with O(n^2).

You need to load the SMOOLIST chunk - its hexadecimal ID is 4150.
Firdt you must calculate per-face normals, then it is necessary to smooth all vertex normals close to each other that belong to the same smoothing group.

Alexander

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!