
before VS all vertexes have different position

and after VS all 0...so how to fix it?
Posted 20 March 2012 - 06:05 PM
Posted 21 March 2012 - 09:13 AM
// // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 // // Parameters: // // float4x4 worldViewProj; // // // Registers: // // Name Reg Size // ------------- ----- ---- // worldViewProj c0 4 // vs_2_0 def c4, 1, 0, 0, 0 dcl_position v0 dcl_color v1 dcl_texcoord v2 mad r0, v0.xyzx, c4.xxxy, c4.yyyx dp4 oPos.x, r0, c0 dp4 oPos.y, r0, c1 dp4 oPos.z, r0, c2 dp4 oPos.w, r0, c3 mov oD0, v1 mov oT0.xy, v2 // approximately 7 instruction slots usedif i understand correctly this is 0 vertex debug.
c4 (1.000,0.000,0.000,0.000) float4 v0 (909.163,59.139,-1585.124,1.000) float4and what is wrong? I can post my VS too.
Posted 21 March 2012 - 09:42 AM
Posted 21 March 2012 - 09:49 AM
Posted 21 March 2012 - 10:40 AM
float4x4 worldViewProj;
struct VS_INPUT
{
float3 position : POSITION;
float4 color0 : COLOR0;
float2 texcoord0 : TEXCOORD0;
};
struct VS_OUTPUT
{
float4 hposition : POSITION;
float4 color0 : COLOR0;
float2 texcoord0 : TEXCOORD0;
};
VS_OUTPUT main( VS_INPUT IN )
{
VS_OUTPUT OUT;
float4 v = float4( IN.position.x,
IN.position.y,
IN.position.z,
1.0f );
OUT.hposition = mul( v, worldViewProj );
OUT.color0 = IN.color0;
OUT.texcoord0 = IN.texcoord0;
return OUT;
}
its my shader code...where can i multiply by a zero here?
Posted 21 March 2012 - 01:28 PM
i tried maybe all...rad SDK and i don't know how to chek it
, can you plz tell me where i can see it?
P.S. If you sure where is the problem - can you simply say how to fix it?
Posted 22 March 2012 - 09:14 AM
float4x4 matWorld; float4 vec_light;
Posted 23 March 2012 - 01:39 PM
float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecLightDir;
struct VS_OUTPUT
{
float4 Pos : POSITION;
float3 Light : TEXCOORD0;
float3 Norm : TEXCOORD1;
};
VS_OUTPUT VS(float4 Pos : POSITION, float3 Normal : NORMAL)
{
VS_OUTPUT Out = (VS_OUTPUT)0;
Out.Pos = mul(Pos, matWorldViewProj); // transform Position
Out.Light = vecLightDir; // output light vector
Out.Norm = normalize(mul(Normal, matWorld)); // transform Normal and normalize it
return Out;
}this shader code need texture coordinates, but when i use PIX - i see that all textures positions are 0. I update all variables in render:
for(int b =1;b<MeshCount+1;b++)
{
for( DWORD i = 0; i < g_dwNumMaterials[b]; i++ )
{
g_bUseShaders = true;
if( g_bUseShaders == true )
{
//
// Use vertex and pixel shaders...
//
g_pd3dDevice->SetMaterial( &entity[b].g_pMeshMaterials[i] );
g_pd3dDevice->SetTexture( 0,entity[b].g_pMeshTextures[1] );
g_pd3dDevice->SetTexture( 1,entity[b].g_pMeshTextures[2] );
D3DXVECTOR3 vecLightDir(10,10,10);
D3DXMATRIX matWorldViewProj = matWorld * matView *matProj;
g_pConstantTableVS->SetMatrix( g_pd3dDevice, " matWorldViewProj", &matWorldViewProj );
g_pd3dDevice->SetVertexDeclaration( g_pVertexDeclaration );
g_pd3dDevice->SetVertexShader( g_pVertexShader );
g_pd3dDevice->SetPixelShader( g_pPixelShader );
g_pMesh[b]->DrawSubset( i );
}
i update all, why shader cannot see coordinates?
Posted 23 March 2012 - 01:50 PM
Posted 24 March 2012 - 01:32 PM
Posted 25 March 2012 - 06:48 AM