Skip to main content
gamedev.net
🔒 Locked

Shading model Question.

Started by kdworld Jul 11, 2008 at 6:23 AM 5 replies 1.4k views
Original Post
kdworld
kdworld
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
pismakron
pismakron
This particular bit of shading information, can be stored as proper vertex normals, which should be part of most 3D meshes.
kdworld
kdworld
Thanks pismakron.

Do you know whether .3ds have this information ? I am dealing with 3ds format.
pismakron
pismakron
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.
NineYearCycle
NineYearCycle
According to this link you'll have to calculate the normals yourself.

Andy
"Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile" "Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgement difficult."
Porthos
Porthos
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
kdworld
kdworld
Thank you Porthos,NineYearCycle.

I will see how to do that according to that idea.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.