MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM...
I tried to change the 0xffffff with 0.
Now the mesh it's visualized correctly!!!
I do not know why...
EDIT: even if i write 1,2,3,4,5,6,7 it works...
Another strange thing it's the shader.
I'm using this 2 simple shaders: one for drawing mesh, another for silhouette detecting:
float4x4 ViewMatrix;float4x4 WorldMatrix;float4x4 ProjMatrix;float4 LightDirection = float4(0.557,0.557,0.557,1);float4 MaterialColor;float3 EyePosition;texture2D Texture;SamplerState SamplText{ Filter = MIN_MAG_MIP_LINEAR; AddressU = Wrap; AddressV = Wrap;};DepthStencilState StencilShadow{ DepthEnable = true; DepthWriteMask = ZERO; DepthFunc = LESS; StencilEnable = true; StencilReadMask = 0xFFFFFFFF; StencilWriteMask = 0xFFFFFFFF; FrontFaceStencilFunc = ALWAYS; FrontFaceStencilPass = INCR; FrontFaceStencilFail = Keep; BackFaceStencilFunc = ALWAYS; BackFaceStencilPass = DECR; BackFaceStencilFail = Keep;};DepthStencilState DefaultDepth{ DepthEnable = true; DepthFunc = LESS; DepthWriteMask = ALL; StencilEnable = false;};struct VS_INPUT{ float4 Pos : POSITION; float3 Tex : TEXCOORD; float3 Nor : NORMAL;};struct PS_INPUT{ float4 Pos : SV_POSITION; float4 WorldPos : WORLDPOSITION; float3 Tex : TEXCOORD; float3 Nor : NORMAL;};float3 GetNormal( float3 A, float3 B, float3 C ){ float3 AB = B - A; float3 AC = C - A; return normalize( cross(AB,AC) );}PS_INPUT vs_main(VS_INPUT Input){ PS_INPUT Out = (PS_INPUT)0; Out.Pos = mul(mul(mul(Input.Pos,WorldMatrix),ViewMatrix),ProjMatrix); Out.Tex = Input.Tex; Out.WorldPos = Input.Pos; Out.Nor = Input.Nor; return Out;}float4 ps_main(PS_INPUT In) : SV_TARGET{ float3 L = normalize(LightDirection.xyz); float4 D = saturate(dot(In.Nor,L) * float4(0.5,0.3,0.4,1) * MaterialColor); float3 V = normalize(EyePosition - In.WorldPos); float3 R = normalize(2.0F * In.Nor * dot(In.Nor,L) - L); float4 S = pow(max(0.0F,dot(R,V)),2); return saturate(D + S); }VS_INPUT vs_shadow(VS_INPUT In){ In.Pos = mul(In.Pos,WorldMatrix); In.Nor = mul(In.Nor,WorldMatrix); return In;}[maxvertexcount(24)]void gs_shadow(triangleadj VS_INPUT In[6],inout TriangleStream<PS_INPUT> Stream){/* Dalla documentazione di D3D10, i vertici originali sono quelli pari, gli adiacenti quelli dispari.*/ if (dot(normalize(LightDirection),GetNormal(In[0].Pos.xyz,In[2].Pos.xyz,In[4].Pos.xyz)) > 0.0f) { PS_INPUT vertex = (PS_INPUT)0; for( uint i = 0; i < 6; i+=2) { uint next = (i+2) % 6; if (dot(LightDirection,GetNormal(In.Pos.xyz,In[i+1].Pos.xyz,In[next].Pos.xyz)) < 0.0f) { vertex.WorldPos = In.Pos; vertex.Pos = mul(mul(In.Pos,ViewMatrix),ProjMatrix); vertex.Nor = In.Nor; vertex.Tex = In.Tex; Stream.Append(vertex); vertex.WorldPos = In[next].Pos; vertex.Pos = mul(mul(In[next].Pos,ViewMatrix),ProjMatrix); vertex.Nor = In[next].Nor; vertex.Tex = In[next].Tex; Stream.Append(vertex); Stream.RestartStrip(); } } }}float4 ps_shadow(float4 Pos:SV_Position) : SV_TARGET{ return float4(1,0,0,1);}technique10 ShadowVolume{ Pass Geometrie { SetVertexShader( CompileShader( vs_4_0, vs_main() ) ); SetGeometryShader(NULL); SetPixelShader( CompileShader( ps_4_0, ps_main() ) ); SetDepthStencilState(DefaultDepth,0); } Pass Shadow { SetVertexShader( CompileShader( vs_4_0, vs_shadow() ) ); SetGeometryShader( CompileShader ( gs_4_0, gs_shadow() ) ); SetPixelShader( CompileShader( ps_4_0, ps_shadow() ) ); } }
The draw functions uses first and second pass.
PIX say me an horrible thing!!!
IMG HERE-> http://img71.imageshack.us/img71/4364/immaginefx1.jpg
Mabye it want to say me that it's not giving out any kind of primitive?
[Edited by - XVincentX on June 28, 2008 11:35:46 AM]