Jump to content
  • Advertisement
Sign in to follow this  
Magos

Solid + Wireframe not working too good

This topic is 4464 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

I'm rendering a model in solid + wireframe mode (first solid then wireframe to better show the edges). However, as shown in the image, some lines appear partially visible (dotted). I'd guess this is a float-resolution problem but since I use the same mesh with the same matrix it should result in the same interpolated positions, right? What could be wrong? I have a lot of code, but my general procedure: ¤ Set world/view/projection matrices ¤ Set fillmode to SOLID ¤ Render mesh ¤ Set fillmode to WIREFRAME ¤ Render mesh The Z-func is LESSEQUAL so the wireframe it *should* render properly above the solid.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by TWild
Perhaps you could scale it a small amount before rendering the wireframe?
I second this suggestion. The other, slightly more complex, method is to extrude a small amount along each vertices normal - you'd need either a vertex shader or a secondary mesh though.

hth
Jack

Share this post


Link to post
Share on other sites
You can do this with the stencil buffer. Draw the wireframe first, generating a mask in the stencil buffer. Then draw the solid polys, filling every pixel that wasn't set in the mask.

Share this post


Link to post
Share on other sites
don: What about "hidden" faces then? Lines that shine though the wireframe but not the solid one will screw things up!

M-knight: This did give a somewhat better look, however other artifacts appeared like parts of lines showing that should not show.

I'm more interested in an explanation WHY this occurs rather than hacking some workaround. The both renders should give the same z-value so why doesn't LESSEQUAL work as it should work, on the EQUAL part?

Share this post


Link to post
Share on other sites
While the wireframe of the backfaces won't be drawn, occluded front-facing triangles would be a problem (i.e. if your mesh contains concave sections) using the method I mentioned.




Share this post


Link to post
Share on other sites
Quote:
I'm more interested in an explanation WHY this occurs rather than hacking some workaround


I would guess, as I'm kinda new to this, that it is similar to "z-fighting" - both the wireframe and the tri fills are on the same plane and are fighting to be shown.

Share this post


Link to post
Share on other sites
Quote:
I'm more interested in an explanation WHY this occurs rather than hacking some workaround. The both renders should give the same z-value so why doesn't LESSEQUAL work as it should work, on the EQUAL part?



Just a guess but I would imagine this is happening because the fill rules for lines are different than those used for filling triangles. The wireframe fill mode is usually drawn using line segments and lines follow GDI's GIQ diamond convention, rather than the top-left fill method used to rasterize triangles.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!