I'm using the D3DXMesh class to load and render objects into my scene. This works fine but there's a little problem when setting the shader mode to D3DSHADE_FLAT, you'll notice the polygons are either 50% or 100% and that's definitely wrong. The meshes are 3ds exports and as you can see on the left side the normals were calculated correctly. I truly have no idea why flat shading won't work here...
It's only the meshes btw, the floor is rendered 'by hand' with my own normal calculations.
I must admitt that I didn't understand the question 100% here....what is the diffrence with the picture on the left and right...and as Cyborg said. Why are you uisng flat shading...why not Gouraud (SP?) or something?
The problem is that D3DMeshes rendered in flat mode seem to be wrong-calculated, there's only 2 steps of darkness in the shadows. Watch the picture, there's coplanar polygons and each one is shaded different - looks quite ugly.
I need flat shading for several objects, eg. robots and glasses with sharp edges. Using gouraud shading make all edges look smooth and round, that's not what I need.
You still didn't answer my question about the diffrense in the two pictures...an other thing...is the box on the top on the right picture 100% flat on the top?
Do you use any kind of light or something? Spot lights or something. If so make sure it hits any of the vertices on the left side of the box on the top too. And not in between, that won't help.
Also don't use D3DSHADE_FLAT. The large quads in your terrain all get colored only one shade using D3DSHADE_FLAT. Try using D3DSHADE_GOURAUD or even better, D3DSHADE_PHONG.
And the reason why your polygons are either 50% or 100% in your box and barrel is because some of your polygons' vertices aren't in the consistent clockwise or counter clockwise order (which depends on if you are using the LH or RH system). And as a result, the normals that are getting calculated on some of the wrong order polygons will be reversed and shaded 100% black as a result!) So be sure that those vertices are in the correct order.
Last edited by Jacob Roman; Dec 5th, 2004 at 11:56 AM.