shaders and vertex

Started by
2 comments, last by giugio 14 years, 11 months ago
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.
Advertisement
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.
I'm not understand at all the stream out , Is a sort of instancing?where I can deepening the topic?

Thanks.
upup

This topic is closed to new replies.

Advertisement