Sign in to follow this  

shaders and vertex

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

Hy. I look at the skinning10 example of the dx 10 sdk. I find that the unique vertex declaration is this:
struct STREAM_OUT_VERTEX
{
    D3DXVECTOR4 Pos;
    D3DXVECTOR3 Norm;
    D3DXVECTOR2 Tex;
    D3DXVECTOR3 Tangent;
};


but the vertex layout is this:

const D3D10_INPUT_ELEMENT_DESC skinnedlayout[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,    0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "WEIGHTS", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0,      12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "BONES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0,         16, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,      20, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0,       32, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,     40, D3D10_INPUT_PER_VERTEX_DATA, 0 },
    };


and the input and output of the shader are these:

struct VSSkinnedIn
{
    float3 Pos	: POSITION;			//Position
    float4 Weights : WEIGHTS;		//Bone weights
    uint4  Bones : BONES;			//Bone indices
    float3 Norm : NORMAL;			//Normal
    float2 Tex	: TEXCOORD;		    //Texture coordinate
    float3 Tan : TANGENT;		    //Normalized Tangent vector
};

struct VSStreamOut
{
    float4 Pos	: POSITION;			//Position
    float3 Norm : NORMAL;			//Normal
    float2 Tex	: TEXCOORD;		    //Texture coordinate
    float3 Tangent : TANGENT;		//Normalized Tangent vector
};


why there isn't a vertex structure like this:
struct STREAM_OUT_VERTEX_IN
{
    D3DXVECTOR4 Pos;

    D3DXVECTOR4 WEIGHT;//new the weight and the bones
    D3DXVECTOR4 BONES;//new 

    D3DXVECTOR3 Norm;
    D3DXVECTOR2 Tex;
    D3DXVECTOR3 Tangent;
};

thanks.

Share this post


Link to post
Share on other sites
That vertex declaration is only for the original input to the skinning vertex shader that actually performs the skinning using bones. It then dumps all of the skinned vertices to a buffer using stream out. Since those vertices are already skinned, they no longer need the bones.

Share this post


Link to post
Share on other sites

This topic is 3147 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this