🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

[Directx 9] HLSL Bones Limit

Started by
13 comments, last by who_say_pawno 3 years, 6 months ago

……….

Advertisement

……….

D3D9 is 18 years old at this point, so it's going to be difficult to find resources and knowledgeable people to help you out here. My memory is pretty fuzzy myself so I can't really give you specifics either, but I will try to point you in the right direction.

  • There's not just going to be a 1-line change to your C++ code to provide your bone matrices as a texture, that's unfortunately not how it works, You're going to have to learn how to create a dynamic texture ("dynamic" here means the CPU can update its contents), lock it, copy in the bone matrices, unlock it, and then bind it to a texture slot for your vertex shader.
  • If you're using old-school shader model 3.0 HLSL then you can't use the shader model 4.0+ syntax for sampling and loading textures, which is what you seem to be doing. Just like any other SM 3.0 shader code you'll want to declare a sampler1, and pass it to tex1Dlod to sample from it (you need to use the variant that takes an explicit mip level since vertex shaders can't automatically compute a mip level for you. But it doesn't really matter in this case since your texture won't have mips, so you would pass a hard-coded mip level of 0).

You can also consider solving this problem by splitting your mesh into multiple parts, with each part using less than your maximum supported bone count.

Purogurama said:
But I still can't get past 80 bones.

your situation is a bit like that of someone who loses a vote… u have to accept your limits ?

u can always try unprecedented ways to still use old tech;… i think the easiest way would be for u:

  • to render your character in 2 passes, 40 bones each, or max out to 64 if i remember well then 16
  • reduce the amount of characters and other objects in scene
  • move to d3d11 soon, your family awaits there ?

If this doesn't kill your perf you're in?

have fun ?

……….

Why do you even need DirectX 9? Now any video card already supports 11. And it is much easier to learn thanks to more complete documentation and has more features.

I'll have two number 9s, a number 9 large, a number 6 with extra dip, a number 7, two number 45s, one with cheese, and a large soda.

This topic is closed to new replies.

Advertisement