Advertisement

[Directx 9] HLSL Bones Limit

Started by November 22, 2020 04:39 PM
13 comments, last by who_say_pawno 3 years, 11 months ago

……….

……….

Advertisement

You could try to pack your bone-data into a vertex-texture (https://docs.microsoft.com/en-us/windows/win32/direct3d9/vertex-textures-in-vs-3-0).

Performance is probably not going to be as good as with constants, but it should still be better than CPU-skinning I assume.

……….

You would treat each pixel in a 1d texture as a row of the matrix. Then each 4 pixels = 1 matrix. In pseudo-code:

int offset = boneId * 4;
float4x4 boneMatrix =
{
	read(boneTexture, offset),
	read(boneTexture, offset + 1),
	read(boneTexture, offset + 2),
	read(boneTexture, offset + 3)
};

Not sure if that constructor exits or what the exact HLSL3-command for reading the texture is, but you should get the idea.

……….

Advertisement

……….

Well, I'm not sure what else to tell you. A 4x4-matrix can be laid out as 4 float4-value, which you should do (in a 1d-texture which is defined as 4 channel 32-bit-floating-point). You then read each float4 sequentially for each blend-index (like I already given you the code above) and simply construct the matrix that you can then multiply with.

……….

@purogurama , try to use Matrix4x3: Rotation (3x3) + Offset

why do you use 4x4 matrix ? for bones there is enough 4x3.

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

This topic is closed to new replies.

Advertisement