Jump to content
  • Advertisement
Sign in to follow this  
NiteLordz

Shader vs Hardware Instancing

This topic is 2375 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

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

Share this post


Link to post
Share on other sites
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!


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!