Jump to content

  • Log In with Google      Sign In   
  • Create Account


DX11 InstanceDataStepRate


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 quaikohc2   Members   -  Reputation: 378

Like
0Likes
Like

Posted 06 May 2013 - 07:52 AM

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?



Sponsor:

#2 TiagoCosta   Crossbones+   -  Reputation: 1844

Like
2Likes
Like

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

 

Most common instancing effects use step rate = 1 though.


Edited by TiagoCosta, 06 May 2013 - 09:54 AM.

Tiago Costa
Aqua Engine - my DirectX 11 game "engine" - In development

#3 InvalidPointer   Members   -  Reputation: 1354

Like
2Likes
Like

Posted 06 May 2013 - 11:35 AM

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.


clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS