• Advertisement
Sign in to follow this  

How to draw nice wireframe?

This topic is 4482 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
Provided your terrain texture is tiled sufficiently, you also can get a nice result by using a simple texture with the outlines of a square on it, with the rest transparent. This gives you a classy retro quad wire look :)

Share this post


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

  • Advertisement