Recuding calls to Draw(Indexed)Primitive
Hey there
Im facing some problems with rendering complex objects in my scene. Those objects are built from several textureunits. Lets say we have an average of 10 units per model. As in a single scene there may be up to 100 models this results in up to 1000 calls to DrawIndexPrimitive (they all are ID3DXMesh). As you can imagine this is pretty bad for the FPS. Does anyone of you know an algorithm or something to reduce this huge amount of calls?
Greetings
Well, the only real options are:
1. Combine several textures into one larger texture
2. Cull invisible meshes
3. Sort so you draw all meshes using texture A, then all using texture B, etc.
#1 sounds simplest.
1. Combine several textures into one larger texture
2. Cull invisible meshes
3. Sort so you draw all meshes using texture A, then all using texture B, etc.
#1 sounds simplest.
Yes, #1 sounds good as i am already doing #2 as good as possible. Is there a way to combine some textures during runtime? This is neccessary because the textures i use are already existing and i dont want to supply them all with my program.
Quote:Original post by PlerionWhat do you mean they already exist?
Yes, #1 sounds good as i am already doing #2 as good as possible. Is there a way to combine some textures during runtime? This is neccessary because the textures i use are already existing and i dont want to supply them all with my program.
It's possible to do at runtime, but it's a bit of a pain to do. You'll need to:
1. Create a new large texture
2. Go through each texture the mesh uses and copy them into the larger texture
3. Lock the attribute and vertex buffer of the mesh
4. Update the texture coordinates in each vertex to correspond to the new coordinates
5. Unlock the AB and VB
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement