Drawing a mesh in direct3D

Started by
1 comment, last by The C modest god 20 years, 6 months ago
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.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Advertisement
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
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).

This topic is closed to new replies.

Advertisement