Jump to content
  • Advertisement
Sign in to follow this  
Geronimo2000

Drawing Wireframe + Shaded

This topic is 4863 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 am using D3D in DirectX 9 for a C# program to draw some models. I can draw them shaded just fine, and wireframe is easy when I render with the D3D-wireframe mode on. The trouble comes when I need to draw the model as shaded with the wireframe on as well. I end up having to draw everything twice (once for shaded and once for wireframe), and this really hurts my performance. I would be appreciative for any high-level overview(s) explaining some good ways to draw shaded + wireframe efficiently in one pass, or any links to pertinent tutorials online related to this. I assume a pixel or vertex shader approach would be intuitive, but I'm not 100% comfortable with them yet, so keep that in mind. Thanks in advance for anything you can offer.

Share this post


Link to post
Share on other sites
Advertisement
Well you can't, WIREFRAME and TRIANGLES need one batch each, they cannot be done in one draw.

But really, why do you need to draw both the wireframe and the solid version?

Share this post


Link to post
Share on other sites
Well, I just do. It doesn't have to technically be wireframe, but it has to look like Maya or other 3D programs which show a shaded model and the 3D wireframe over it.

I'm kind of surprised there are no shader solutions for this... that kind of sucks.

Share this post


Link to post
Share on other sites
First, make sure that Z-Write is enabled and render your mesh in wireframe mode.
Then, set the device to only allow pixels with a Z-Value "smaller than" (I don't know how to explain), and render your mesh with normal shading.

Another solution would be to use the stencil buffer, rendering the wireframe and setting the pixels values to >0, so later when you render the shaded mesh, you'll only accept pixels with a stencil value =0.

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!