Drawing a mesh in direct3D
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.
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
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).
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
Popular Topics
Advertisement