Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualTiagoCosta

Posted 06 May 2013 - 09:54 AM

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.


#1TiagoCosta

Posted 06 May 2013 - 09:53 AM

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 },
};

PARTNERS