Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

The C modest god

Drawing a mesh in direct3D

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

Lets say there is a mesh with two surfaces to it. How would the process of drawing this mesh with direct3D could be done? Lets say we take a vertex buffer, fill it with the vertices of the mesh, then use DrawPeremitive to draw part of the buffer with one surface and then use it again to draw the other part? Wouldnt that involve some unnecessary drawings? like when the vertices of the first surface are bellow the vertices of the second surface but drawen first because they areof the first surface? I would appreaciate help on this matter.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
D3D, by default, will cull trianges that aren''t facing forward. so you won''t worry about drawing them twice. In my code I have 1 mesh with many surfaces, I sort mine by materials and use draw indexed primitive to prevent rendering parts of the mesh that aren''t needed.

hope this helped

Share this post


Link to post
Share on other sites
The overdraw introduced here is inevitable (unless you have a really good algorithm to clip one surface with the sides of the other one).

You can however, avoid unnecessary z-compares if you draw your surface list back to front (and of course, disable z-testing).

Share this post


Link to post
Share on other sites

  • 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!