Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm loading the exact same model with Assimp, except one is exported from Blender, shaded smoothly, and the other was exported from Blender, shaded flatly. Here is my results from loading both into my game: enter image description here

The Flat drawn model has 1968 vertices and the Smooth drawn model only has 671, why is this happening, I don't understand why there would be less vertices when it's shaded smoothly...?

share|improve this question
    
They are the exact same models, I'm calling mNumVerctices for both of the scenes that they are apart of and getting the numbers –  Brendan Webster May 19 '13 at 3:21

1 Answer 1

up vote 3 down vote accepted

For smooth shading, two adjacent triangles must share common vertex normals. The reason is interpolation. The normal from one vertex is smoothly interpolated to the normal on the second vertex. You need to ensure that the normal of triangle at a particular vertex matches the normal of all adjacent triangles at that same vertex. If you think of a smooth sphere, each vertex on the surface (which is used by multiple triangles) has a single normal.

With flat shading, the normal for each vertex on every triangle must be the same so that when interpolated the value is the same across the whole surface. This means that if a single vertex is shared by multiple triangles then the vertex must be duplicated for each triangle in order to have an independent normal for each triangle.

Overall this means that a smoothly-shaded model can share vertices in ways that a flat-shaded model cannot.

share|improve this answer
    
Are there more normals than there are vertices when it comes to smoothly shaded models? –  Brendan Webster May 19 '13 at 3:47
    
No, it's a 1-1 mapping for a smooth surface. In graphics pipelines and typical supporting model formats a vertex includes properties like position, normal, texture coordinates, and so on. That's why they need to be duplicated for flat-shaded models: even though the position is the same for some logical vertex in the model the normal must be different so the entire vertex must be duplicated for each face. –  Sean Middleditch May 19 '13 at 3:54
    
Alright thanks for the help –  Brendan Webster May 19 '13 at 3:58
    
You'd still end up with duplicated vertices for hard edges even when using smooth shading. A cube has only 8 vertices geometrically but the graphics pipeline will need 24 vertices in order to give each face its own uniform normal. If you share the vertices at each corner then the lighting will look really weird. –  Sean Middleditch May 19 '13 at 3:58
1  
One additional consideration is if you wish to be able to generate normals for smoothly shaded models - in that situation you must know the topology of the model in order to be able to correctly average the planar vertices that are shared between faces –  Mark Mullin May 19 '13 at 10:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.