Mesh drawing?

Started by
5 comments, last by Xeile 18 years, 5 months ago
Hello all, I got a problem rendering my meshes. I got a screeny under with 2 samples, the left sample is rendering of DXViewer which shows it correctly and the right is my application which doesn't draw it like I want it. My application presents some triangles of the back in front of the mesh. Left is DXViewer image, right is application image. DXViewer shows correctly. What could be causing this rendering-behavior in my application, what settings might I forgot about? Thank you, Xeile
Advertisement
are you clearing your z-buffer?

i.e:

this.D3DDevice.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1, 0);

p.s. i don't think clearing a zbuffer could save that nasty looking mesh!
Quote:Original post by vidalsasoon
are you clearing your z-buffer?

i.e:

this.D3DDevice.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1, 0);

p.s. i don't think clearing a zbuffer could save that nasty looking mesh!


Yep, I'm indeed clearing the target and ZBuffer every frame.

Did you try using a mesh that was included with the SDK?

Maybe try running "Optimize" on the mesh...

i.e. mesh.OptimizeInPlace( MeshFlags.OptimizeCompact | MeshFlags.OptimizeAttributeSort, (GraphicsBuffer)null );

If those don't help, I don't know what could be wrong.
Hmm... what are your backface triangles culling settings? I suggest:
pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW );
This is a depth buffer problem.
What is your depth buffer set at?
you could try
presentParams.EnableAutoDepthStencil = true;presentParams.AutoDepthStencilFormat = DepthFormat.D24S8;

and then also making sure your near and far plane of your projection matrix is set correctly. Usually this works if it's set at 1.0f and 1000.0f respectively.

I hope this helps.
Take care.
Quote:Original post by Armadon

And then also making sure your near and far plane of your projection matrix is set correctly. Usually this works if it's set at 1.0f and 1000.0f respectively.

I hope this helps.
Take care.


That was the problem, I had the nearplane set to 0.0f. On the moment you mentioned near plane, I slapped myself... Well making errors is human, I guess.

Thanks for all the help

This topic is closed to new replies.

Advertisement