Jump to content
  • Advertisement
Sign in to follow this  
quaikohc2

DX11 DX11 InstanceDataStepRate

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

Have you found any use for this field in D3D11_INPUT_ELEMENT_DESC? In all examples I could find it's set to zero when instancing is not used and to 1 when it is. That makes sense. I am just wondering if setting this to sth > 1 can be possibly useful for anything?

Share this post


Link to post
Share on other sites
Advertisement

It can be useful in some effects.

 

Example:

 

Drawing a model multiple times at different positions in pairs (each pair with a different tint).

struct VS_IN
{
    float3 position;
    ...
    float4x4 instanceWorld : mTransform ;
    float4 tint : mTint;
};
 

 

Since 2 instances should be draw with the same tint the instance step rate is 2

const D3D11_INPUT_ELEMENT_DESC instlayout[] =
{
    ...
    { L"mTransform", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { L"mTransform", 1, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 16, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { L"mTransform", 2, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 32, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { L"mTransform", 3, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 48, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { L"mTint", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D11_INPUT_PER_INSTANCE_DATA, 2 },
};

 

Most common instancing effects use step rate = 1 though.

Edited by TiagoCosta

Share this post


Link to post
Share on other sites

I actually came up with a nifty way of using this-- particle LOD. Instead of having one giant honking texture with multiple particles packed onto it (think a cloud of sparks), you can actually create a few (geometrically) distinct particles that are simmed/drawn as one unit. In the vertex shader, you can add some random offsets to each sub-particle and get something visually identical with less fillrate consumption.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!