Sign in to follow this  

Rendering Multiple Objects Methods

This topic is 4712 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 just looking for advice on the most efficent way to render the following situation. I currently have 10-15 identical models, that all move independantly of each other. Eash model is made up of approx 100 poly's. Is it more effiecent to set the texture, then call DrawIndexedPrimitive with different world matrices 10-15 times, or would it be more efficent to have all the objects in one index buffer, and then to modify each object by applying the matrix transformation to the verts themselves (my matrix transformation code is pretty fast) and render all the objects with one call to DrawIndexedPrimitive? Now i know that calling drawPrim with 15x the number of verts is faster than calling it 15 times, but i suppose i am looking at the issue of setting my own matrix transformations, and then having to lock and update the index buffer each frame. Any advice on this would be appreciated Thanks Princess Daisy

Share this post


Link to post
Share on other sites
In case your objects are sufficiently simple, instancing (d3d9 new feature) could be the fastest option.

Using you own matrix tranformation is not a good choice for sure, hardware will do this much better.

And besides, rendering 15 models, each with 100 polys is not something you could measure performance at, so don't really bother about performance - it's far to few geometry.

Cheers!

Share this post


Link to post
Share on other sites
The reason i was worried about callign DrawPrim 15 times (which i admit would not be that big a problem) is that i have many different kinds of objects.

For example, I may have 15 objects of one kind 20 objects of another, 7 of another 8 of another etc...

Now in the above example, I coudl call it either approx 50 times, or 4 times. Thats when i start to see it as a problem...

Princess Daisy

Edit: I also read somewhere (i think it was on here) that passing less than 1,000 (or was it 10,000) verts to DIP was a waste of cycles. What i guess im wondering is if doing my own vertex transforms is faster than the wasted calls to DIP...

[Edited by - PrincessDaisy on January 16, 2005 5:35:44 PM]

Share this post


Link to post
Share on other sites
I believe, up to say 500 draw calls per frame should be well handled by Direct3D. If you're not about rendering hundreds or thousands, then drawing each object separately should work fast enough.

Cheers!

Share this post


Link to post
Share on other sites
MickeyMouse is correct on this. Instancing is the best way to go. Locking/unlocking your vertex buffers every frame and performing the transformations yourself is NOT what you want to do for this.

If you don't want to do instancing, see if there is a way to combine your objects in such a way as they share transformations. Perhaps the transformation for an object of one kind is the same as the transformation for an object of another kind in your application. If you don't want to do instancing, then the best solution is to set your matrix, render your object, and then set another matrix... Make sure you've optimized your meshes by grouping similar materials/textures/shaders together as much as possible. If you're using ID3DXMesh, you can use the ID3DXMesh::OptimizeInPlace method.

neneboricua

Share this post


Link to post
Share on other sites

This topic is 4712 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this