Jump to content
  • Advertisement
Sign in to follow this  
michaelmk86

DX11 DX11 Instancing question

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

Advertisement

you mean like that ?

struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    matrix instancePosition;
};

and in what way should I modify the D3D11_INPUT_ELEMENT_DESC ?

        polygonLayout[2].SemanticName = "TEXCOORD";
	polygonLayout[2].SemanticIndex = 1;
	polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
	polygonLayout[2].InputSlot = 1;
	polygonLayout[2].AlignedByteOffset = 0;
	polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
	polygonLayout[2].InstanceDataStepRate = 1;

 

Share this post


Link to post
Share on other sites

You will need multiple elements inside the InputLayout describing the matrix (incrementing the SemanticIndex and AlignedByteOffset).

The DirectX SDK (june 2010) has a sample about instancing that uses this method ( inside the Direct3D10 folder, so minor changes might be needed to adapt it to Dx11)

Share this post


Link to post
Share on other sites
  • looks like  passing the rotation with TEXCOORD is not possible.
  • using an  array of matrices (inside constant buffer) and index it using SV_InstanceID works with rotation, but it can only pass 1024 matrix meaning i can only have 1024 instances of the same model.
  • looking at the DirectX SDK(Direct3D10 folder, Instancing10) i find that is doing Instancing with this  "row_major float4x4 mTransform : mTransform;" but i have idea how to use this in dx11, in order to get  Instance with rotation and in large numbers like 10k not just 1024.

 

any ideals?

Edited by michaelmk86

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!