Jump to content
  • Advertisement
Sign in to follow this  
peter_b

How to draw nice wireframe?

This topic is 4639 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i need a way to draw wireframe ontop of my filled meshes. I have tried to just render the wireframe after the solid mesh, but this results in zfightning if the zbuffer dont take it completely. Turning of read from zbuffer will overdraw geometry infront of the mesh. :( I also have tried to move the mesh i draw as wireframe 0.001f closer to the camera, but it looks wierd. Anyone got any tip on how to do nice wireframe overdrawing? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
depth-bias is your solution ^^
In my program, this setting gives a good result for my terrain :


float bias = -0.6f;
m_pd3dDevice->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD *)&bias);



You can find the description in the DirectX documentation. But to explain it in a few words : it basically add or remove a certain value to the depth value of a pixel. There are 2 different depth bias : fixed, and slope. The slope depth bias adds or removes a value which depend on the orientation of the triangles (I think) and the fixed one only add / remove a fixed value.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!