Sign in to follow this  
Maciek

DX9/10 Instancing small piece of geometry

Recommended Posts

First and foremost - sorry for my English, for I am not a native speaker :) As a part of a huge project, I'm rendering complex and triangle heavy surface made out of so-called bricks. At present, I think, that a single brick will have no more than 2-3 triangles and there will be no more than 40 types of bricks and (which is crucial) approximately 2 milions of bricks total covering the surface. This is something similar to Marching Cubes Algorithm variations. To the point. My questions is: Is Hardware Instancing worth using when instanced object has only ONE or FEW (2-3) triangles? The prop is that triangles will have only Translation Vector passed to GPU as additional data associated with particular object. I'm not using any textures (only one color) and rotations are already implemented in form of different brick types. Is using instancing in such case, a performance boost or fallback? Will answer to my question vary in case of DirectX10? I hope that someone with extensive knowledge about DirectX API and Graphics Card will answer, because I'm sure my tests with and without instancing will not be credible because of helluva aspects which have impact on gpu performance. P.S. Since I bought GeForce 8800GTS, I've been thinking of using Geometry Shader as well.

Share this post


Link to post
Share on other sites
Instancing will only reduce CPU load, not GPU load. So you'll only see a performance increase if you're CPU bound.

But I suspect if you're making 2 million draw calls per frame, you'd be running at about 10 seconds per frame...

Performance boosts from instancing doesn't depend on how many triangles are drawn; that's irrelevant. What matters is how many draw calls you make, and how many draw calls you can save through instancing.

Draw calls in DX10 are much cheaper than they are in DX9, but 2 million of them are sure to murder performance whether you're using DX9 or DX10. Using instancing, you can potentially render all of your 2 million bricks in 40 draw calls. You've basically got the ideal case for instancing - you're rendering a lot of objects which are very similar, and each object doesn't have much unique data.

I say go for it, and see what you get. I suspect you should be able to drasically increase performance using instancing. Something to note, though, is that instancing is easier to achieve in DX10 than it is in DX9.

Share this post


Link to post
Share on other sites
Thanks for anwser.

From what you said, if I threw all geometry in one Vertex Buffer and make a single draw call (drawing 2 milions of triangles) then instancing shouldn't be way to go? right?

Share this post


Link to post
Share on other sites
I wouldn't throw them all in one vertex buffer. The vertex buffer would be positively huge which creates all sorts of problems on its own, plus you'll have a hard time culling out portions of your geometry (I assume you're going to test for visibility so you're not always rendering all 2 million of those polys). Instancing will give you more flexibility, and is supported natively in D3D10.

Share this post


Link to post
Share on other sites

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