tags:

views:

262

answers:

1

I have a problem about rendering a 3D mesh object. I prepared the 3D mesh object in C# and rendered it. Unfortunately, the edges that must be sharp are camber.

Could one explain me what the reason is.


I am using visual studio 2008 - C# Express Edition. The 3D closed mesh object has appr. 66.000 vertexes. At the same time, it has not only flat surfaces, but also curved surfac


I mean the edge at which two flat surfaces meet is not straight.

+1  A: 

Your vertices only have one normal - that being the average of the normals of all the triangles that share that vertex.

To get flat shading each vertex has to be treated as though it has [n] normals - where [n] is the number of triangles that share the vertex and each normal has to be the same as the normal of the triangle. Some systems required that the vertex does have [n] normals, but it isn't strictly necessary if you know that you are flat shading across all triangles you can inherit the normal from the triangle. If (as Warren Young mentions) some parts are flat shaded and others are smooth shaded then you will need to assign extra normals at those vertices where flat shaded triangles meet.

Without details of the modelling system you are using, (and perhaps not even then!) I can't suggest how you might achieve this.

ChrisF
Really? Why not just use the polygon's normal for flat shading?
Warren Young
@Warren Young - I thought I said that when I wrote "you can inherit the normal from the triangle."
ChrisF