Shader vs Hardware Instancing

Started by
1 comment, last by NiteLordz 12 years, 4 months ago
Hello all. This is not so much a vs thread, as it is a pro and con thread. Previously i have used Shader Instancing ( passing in a constant buffer and using the InstanceID to get the values ). I used this for skinned models which worked nicely ( based on the sample from nVidia ). However, i am curious to hardware instancing ( using the vertex buffer to pass the data ).

For static models, is it preferred to use hardware instancing or is really a choice of preference? what are the pros and cons to each.

To my knowledge, shader instancing is a feature of DX10+ so that is a requirement. I am going to setup hardware instancing just to test things out and get a feel for it, but i am curious to what others have seen performance and ability wise.

Thanks much
Code makes the man
Advertisement

Hello all. This is not so much a vs thread, as it is a pro and con thread. Previously i have used Shader Instancing ( passing in a constant buffer and using the InstanceID to get the values ). I used this for skinned models which worked nicely ( based on the sample from nVidia ). However, i am curious to hardware instancing ( using the vertex buffer to pass the data ).

For static models, is it preferred to use hardware instancing or is really a choice of preference? what are the pros and cons to each.

To my knowledge, shader instancing is a feature of DX10+ so that is a requirement. I am going to setup hardware instancing just to test things out and get a feel for it, but i am curious to what others have seen performance and ability wise.

Thanks much


Both of the techniques you present are done in hardware so both of them are called (hardware) instancing.

When using a second vertex buffer stream, the vertex input structure gets bigger in the vertex shader and this was bad on hardware XYZ as on another card the second vertex stream was the preferred method. There is no simple answer for this question. AFAIK, In general reading data from multiple streams _may_ affect performance.

When using D3D10 (or was it D3D11) level hardware you may even provide the instance data in a general (floating point) buffer-object, without any particular structure inside which may make the code much more flexible. I'm planning to try this method in the near future. I feel that the 2nd vertex stream requires a bit too much on maintenance if I want to add more per instance input values.

Cheers!


Thanks for the input. After reading up some more on the second vertex stream, this technique almost seems to be more hassle then work. Setting up the Constant Buffers ( for transforms, etc... ) was very simple to setup and populate with data inside the engine that it seems to be the easier choice. i was just curious as to if one should be used for static objects, or if it really doesn't matter. I will probably just stick with using the second method ( Pass constant buffer into shader ) as i am limited to only using DX10 hardware right now, until the new year.

Thanks much
Code makes the man

This topic is closed to new replies.

Advertisement