Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Arcibald Wearlot

storing indices in a vertex format (for skinning)

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

I''m looking for a way to store indices in my vertex format (I''m using DirectX 8.1 and vertex shaders). The documentation seems to suggest to use the D3DFVF_LASTBETA_UBYTE4 flag, but I heard that GeForce cards do not support it. I have a book, "Real time rendering tricks and tecniques in Dx 8.1" wich uses floats to store indices, but is this correct? I mean ok, it works, but how can a float be used as an index! The last alternative is to use D3DFVF_DIFFUSE and store the indices in the color DWORD, say in the 2 lower bytes; now the problem is how to get the two bytes from the DWORD in the shader, I have no idea on how to do this. So what would you suggest to do? thanks for your help

Share this post


Link to post
Share on other sites
Advertisement
The graphics card only deals with floats, so using floats as indices is odd but normal... it just rounds down.

Since skinning on hardware assumes a shader, it also assumes you can make your own vertex declaration instead of using an FVF. I''ve originally used float4 for weights and float4 for ids, and switched to float4 for weights and COLOR for ids. Note that COLOR is the datatype, I still have another color which is the real diffuse value.

The color DWORD comes into the shader as 4 values from 0 to 1 in the order (r,g,b,a) (note the source format in the VB is a D3DCOLOR ARGB). Simply read the appropriate swizzle, multiply it back up, and put it in A0.x. Although the documentation claims the value is value/255, several people have notices that multiplying by 255 doesn''t give the correct result, they need to multiply by 256 (I multiply by 768 myself). Just a warning.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!