Advanced VBuffer?
I was thinking of how to optimize my performance and thought what if I created one huge vertex buffer out of all my meshes and even my sprites and then simply drew that? The only prob I see is when rendering alpha. The buffer would have to draw from front to back?
The question is this, can this front to back rendering be handled by simply creating a new index buffer per frame? Or would that be bad, slow performance to lock buffer or such?
Any ideas are super welcome,
-Devin
Try this. I am getting perfect result. and not need to drawing front to back.
lpDevice->BeginScene();
//Render first
RenderNormalobjects();
//Render last
lpDevice->SetRenderState(D3DRS_ZWRITEENABLE,false);
RenderAlphaObjects();
RenderParticles();
...
lpDevice->SetRenderState( D3DRS_ZWRITEENABLE,true);
lpDevice->EndScene()
lpDevice->BeginScene();
//Render first
RenderNormalobjects();
//Render last
lpDevice->SetRenderState(D3DRS_ZWRITEENABLE,false);
RenderAlphaObjects();
RenderParticles();
...
lpDevice->SetRenderState( D3DRS_ZWRITEENABLE,true);
lpDevice->EndScene()
I've read that you want to keep your vertex buffers around 2000 vertices each. Too many vertex buffers require too much overhead. Too many vertices in a buffer is apparently slower. So you'll want to combine different objects into a single vertex buffer, but not too many. Also, you will need a vertex buffer for each vertex format.
3ddreams,
Thanks for the alpha help. But what about alpha objects that are behind the normal objects. If the normal objects are drawn first, then won't those alpha objects draw over things they are not supposed to?
Blaze02,
Which do you think would be faster? quantity ten of 2,000 vertice buffers drawn one at a time or one 20,000 vertice buffer drawn once? I sent a post earlier and someone explained about the lag of multiple draws.
Thanks,
Devin
Thanks for the alpha help. But what about alpha objects that are behind the normal objects. If the normal objects are drawn first, then won't those alpha objects draw over things they are not supposed to?
Blaze02,
Which do you think would be faster? quantity ten of 2,000 vertice buffers drawn one at a time or one 20,000 vertice buffer drawn once? I sent a post earlier and someone explained about the lag of multiple draws.
Thanks,
Devin
Quote:Original post by devronious3ddreams' code doesn't disable Z-Testing, only Z-Writing... so it'll still clip semi-transparent geometry to any existing geometry.
Thanks for the alpha help. But what about alpha objects that are behind the normal objects. If the normal objects are drawn first, then won't those alpha objects draw over things they are not supposed to?
Although one thing that 3ddreams' code doesn't seem to do is sort from back-to-front. That code is similar to what I've used for particle systems before and it's worked great, but for more complex semi-transparent geometry I've got odd artifacts by not sorting things properly. YMMV.
Quote:Original post by devroniousPre-D3D10 the context switch incurred by Draw**() calls does mean that a high number of them can mean you end up wasting much of your time. However, there is always a sweet-spot between 1 huge buffer and many small buffers - there isn't really a one-size-fits-all answer. If you dig around on the ATI and Nvidia website they tend to have presentations/whitepapers on this sort of thing. I know there was an excel spreadsheet on the Nvidia site that had results of different vertex and batch sizes - and you can use that to try and guage the optimal batch size.
I sent a post earlier and someone explained about the lag of multiple draws.
hth
Jack
Jolly,
Thanks I got zwriting confused with zbufferenable. That makes sense.
Also read about D3D10 instancing when looking up batching. Looks pretty powerful. Perhaps I'll migrate into D3D10 now before I complete my engine. Is D3D10 ready to go?
-Devin
Thanks I got zwriting confused with zbufferenable. That makes sense.
Also read about D3D10 instancing when looking up batching. Looks pretty powerful. Perhaps I'll migrate into D3D10 now before I complete my engine. Is D3D10 ready to go?
-Devin
Quote:Original post by devroniousNot really. There aren't any Direct3D 10 cards on the market yet, and D3D10 isn't backwards compatible (Meaning you need a D3D10 card to use it, you can't use it on an ATi X1900 or anything). That's actually a good thing though, since a lot of the crap has been dropped. Still, you can only use the reference rasterizer till D3D10 cards come out.
Is D3D10 ready to go?
It's almost certainly better to stick with D3D9 now, unless you've just started the engine and you expect it to be in development for a long time.
Steve's covered the main points... but there is also the other added factor (if you weren't aware) that D3D10 is Windows Vista only - so for now you'll need to be an MSDN subscriber or on the Vista beta program...
Developing anything beyond samples via the reference rasterizer is a challenge in itself - typically it'll require some degree of automation so you can leave it to effectively batch-render a number of frames and then play it back as a movie...
hth
Jack
Developing anything beyond samples via the reference rasterizer is a challenge in itself - typically it'll require some degree of automation so you can leave it to effectively batch-render a number of frames and then play it back as a movie...
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement