Jump to content
  • Advertisement
Sign in to follow this  
AquaMacker

What is BoneIndex, DXGI_FORMAT ?

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

HI~

 

I wonder BoneIndex DXGI_FORMAT.

 

This is my result. BONE INDEX, Weight.
[attachment=20693:BoneIndexWeight.png]

I guess, this result is good. But Drawing is wrong.

In MSSDK,

BoneIndex DXGI_FORMAT is { "BONES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0 }

But I Can't.

 

My vertex struct is

 

D3DXVECTOR3 vPos;
D3DXVECTOR3 vNormal;
D3DXVECTOR2 vTex;
D3DXVECTOR3 vBiNormal;
D3DXVECTOR3 vTangent;
UINT nIndex[4];
float fWeight[4];

 

My BoneIndex DXGI_FORMAT is { "BONES", 0, DXGI_FORMAT_R32G32B32A32_UINT, 0, 56, D3D10_INPUT_PER_VERTEX_DATA, 0 },

 

Is Wrong ?

Edited by AquaMacker

Share this post


Link to post
Share on other sites
Advertisement

Your version is correct.  What is the problem, other than “drawing is wrong”?

Also, why “can’t” you pack them into a single UINT and send them as DXGI_FORMAT_R8G8B8A8_UINT?

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites

You will need to elaborate on "drawing is wrong". Do you mean the skinning is resulting in warped results? Perhaps if you could provide a screenshot for us.

 

If the data looks correct for you in bone indices, then what about the matrices that they point to? Do they look correct? What does that constant buffer look like? Do you know if your calculations are done correctly with regards to the parent bone and so on?

Edited by spazzarama

Share this post


Link to post
Share on other sites

I solved this problem. ^^a

This is not BoneIndex format but WEIGHT format !

 

First - wrong DXGI_FORMAT

{ "BONES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, 56, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "WEIGHTS", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 60, D3D10_INPUT_PER_VERTEX_DATA, 0 },

Second - correct DXGI_FORMAT
{ "BONES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, 56, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "WEIGHTS", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 60, D3D10_INPUT_PER_VERTEX_DATA, 0 },

I solved it ^^;

But I don't understand yet.
Why float[4] of weight can't use DXGI_FORMAT_R8G8B8A8_UNORM ?
Range of Weight value is 0.0f ~ 1.0f. But can't...

And...
Thanks very much for answer. @L. Spiro, @spazzarama ^^a
Have a good day smile.png
 

Share this post


Link to post
Share on other sites

The format enumeration specifies the number of bits in each component. float[4] requires 4 * sizeof(float) = 4 * 32 bits = 128 bits. R8G8B8A8 only provides a total of 32 bits.

 

EDIT: check the docs for DXGI_FORMAT enumeration.

Edited by Buckeye

Share this post


Link to post
Share on other sites

I knew that...

But I refer to MSSDK Skinning10, MSSDK Skinning10 use R8G8B8A8_UNORM.

And I use 
R8G8B8A8_UNORM, But I don't working, MSSDK working well.

I don't understand.

 

Share this post


Link to post
Share on other sites

It is really quite simple.

// == COMPONENTS

R = x[0]

G = x[1]

B = x[2]

A = x[3]

 

 

// == BITS PER COMPONENT

8 = bits in x

 

 

// == SIGN

U = Unsigned (byte)

 

 

// == RANGE

NORM = converted to float and normalized to 0.0-1.0

 

 

You have float[4].  float is 32 bits.  That’s R32G32B32A32.  Why would you expect R8G8B8A8 to work if you are using R32G32B32A32 (float[4]) for your client data?

It doesn’t make sense.  Why would yours work?

 

 

float[4] = R32G32B32A32

byte[4] = R8G8B8A8

 

So if you are going to send DXGI_FORMAT_R8G8B8A8_UNORM, you need to convert your float[4] into a byte[4].

byte[0] = float[0] * 255 + 0.5
byte[1] = float[1] * 255 + 0.5
byte[2] = float[2] * 255 + 0.5
byte[3] = float[3] * 255 + 0.5

 

 

L. Spiro

Share this post


Link to post
Share on other sites

Thanks so~~~~~~~~~~~~ much. smile.png 

Question is solved clearly perfectly. smile.pngsmile.pngsmile.png
 

Have a nice day @L. Spiro, @spazzarama, @Buckeye

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!