• Advertisement

8up tuotlo

  • Content count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About 8up tuotlo

  • Rank
  1. Help with Skinned Mesh shader

    Thanks for quick and good ansver. In Shader model 4 and 5 it will be more place?
  2. I am use this HLSL D3DXEFFECT shader to draw my animated model in my application. Shader model 3.0.   [source]   //-- Lighting ------ struct Direct { float3 pos; float3 col; }; Direct Dl[2]; float3 Al; //------------------   float3 eye;   float Sp;   float4x4 BM[60];   float4x4 Gm; float4x4 Wm;   struct VS_in { float4 Pos  : POSITION; float3 Norm : NORMAL; float2 Tex  : TEXCOORD0; float4 bi   : BLENDINDICES0; float4 bw : BLENDWEIGHT0; };   struct VS_out { float4 Pos  : POSITION; float3 Norm : TEXCOORD1; float2 Tex  : TEXCOORD0; float3 wPos : TEXCOORD2; float3 v    : TEXCOORD3; };   VS_out vs(VS_in In) { VS_out Out;   float4x4 blend = BM[In.bi.x]*In.bw.x + BM[In.bi.y]*In.bw.y + BM[In.bi.z]*In.bw.z + BM[In.bi.w]*In.bw.w;   float4 SkinPos, SkinNorm;   SkinPos.x = (In.Pos.x * blend._11)+(In.Pos.z * blend._21)+(In.Pos.y * blend._31)+(blend._41); SkinPos.z = (In.Pos.x * blend._12)+(In.Pos.z * blend._22)+(In.Pos.y * blend._32)+(blend._42); SkinPos.y = (In.Pos.x * blend._13)+(In.Pos.z * blend._23)+(In.Pos.y * blend._33)+(blend._43); SkinPos.w = 1.0f;   SkinNorm.x = (In.Norm.x * blend._11)+(In.Norm.z * blend._21)+(In.Norm.y * blend._31); SkinNorm.z = (In.Norm.x * blend._12)+(In.Norm.z * blend._22)+(In.Norm.y * blend._32); SkinNorm.y = (In.Norm.x * blend._13)+(In.Norm.z * blend._23)+(In.Norm.y * blend._33); SkinNorm.w = 1.0f;   Out.Pos = mul(SkinPos, Gm); Out.Tex = In.Tex; Out.Norm = normalize(mul(SkinNorm, (float3x3)Wm)); Out.wPos = mul(SkinPos, Wm); Out.v = eye.xyz - Out.wPos;   return Out; }   float3 light(float3 n, float3 v) { float  nDotL[2];   nDotL[0] = saturate(dot(n, normalize(Dl[0].pos))); nDotL[1] = saturate(dot(n, normalize(Dl[1].pos)));   float3 ret = Dl[0].col * nDotL[0] + Dl[1].col * nDotL[1] + Al; /*+ (Dl[0].col * ((nDotL[0] == 0.0f) ? 0.0f : pow((saturate(dot(n, normalize(Dl[0].pos + v)))), Sp)));*/   return ret; }   float4 ps(VS_out In) : COLOR0 { return float4(light(normalize(In.Norm), normalize(In.v)), 1); }   technique Standart {      pass P0     {                   VertexShader = compile vs_3_0 vs(); PixelShader  = compile ps_3_0 ps();     } }   [/source]   it is maximum of 60 bones by:   float4x4 BM[60];   when i try to set it to:   float4x4 BM[120];   shader not works.   Who knows why? Can it be set to 120, and how if it is possible?
  3. HLSL - Billboarding a mesh

    Try to do so:   matrix worldViewMat = mul( worldMatrixInstance, viewMatrix ); output.position = mul(skinnedPos, worldViewMat ); output.position = mul(output.position, transpose(float3x3(worldViewMat)) );   or this:   matrix worldViewMat = mul( worldMatrixInstance, viewMatrix );        output.position = skinnedPos + mul(float4( worldViewMat._41, worldViewMat._42, worldViewMat._43, 1.0f ), worldViewMat );
  4. Is it possible to set depth buffer as the texture to effect (LPDIRECT3DEFFECT9) in direct3d?   thanks.
  5. HLSL - Billboarding a mesh

    Try to do so:   Get the transpose(float3x3(your WorldViewMatrix)); Get your mesh in local space, multiple him on this ^ And than multiple him as simple, no billboarded mesh;   and try to set culling mode off
  6. 'usp10.h' no such file or directory

    http://sourceforge.net/p/mingw/mingw-org-wsl/ci/master/tree/include/usp10.h   maybe it helps
  7. multi screen help

    See Multi Windows example in Microsoft directX SDK
  8. DirextX antialliasing is acceptble only for triangles no lines and points
  9. D3DVIEWPORT9 Viewport;   Viewport.X = 0; Viewport.Y = 0; Viewport.Width  = 200; Viewport.Height = 200; Viewport.MinZ   = 0.0f; Viewport.MaxZ   = 1.0f;   d3ddev->SetViewport(&Viewport);
  10. HLSL - Billboarding a mesh

    on my mind billboarding its placing triangle fefore screen without rotations(always to us)   just make WorldViewMatrix Add to triangle WorldViewMatrix[3] - translation and multiple it on projection   all   that what you doing is too much
  11. i am using this to set filtering of texture...     sampler2D DTS = sampler_state { Texture = <DiffuseMap>;     MagFilter = Linear;     MinFilter = Linear;     MipFilter = Linear; };   how to apply filtering on any channel of texture?   thanks
  12. HLSL - Billboarding a mesh

    Yes it is...   you have billboarding working correctly or its any problems?
  13. many GOOD Games were been maked with dx9 many old videocards not support dx11 and it will be funny if your LITTLE game will work only on top hardware ;[
  14. HLSL - Billboarding a mesh

    Yes, it is. BUT your triangle must already be placed in CMERA coordinates in vertex buffer(your mesh). it means thad what up side of your triangle is y+; front side z+( or z-) i forget ( try two variants;  and right side is x+;   THAN THIS works so   if( flags & PER_MESH_FLAG_BILLBOARD )     {         matrix boneWorldMatrix = mul( bonematrix, worldMatrixInstance );             matrix boneWorldViewMatrix = mul( boneWorldMatrix, viewMatrix );                    float3 position = input.position + float3( boneWorldViewMatrix._41, boneWorldViewMatrix._42, boneWorldViewMatrix._43 );         now we TRANSLATE our triangle from Object space to World space ONLY translate no rotations (and this is the bilboarding)         output.position = mul( float4( position, 1.0f ), projectionMatrix ); standart projection     }     else     {             output.position = mul(output.position, projectionMatrix);     }       we do NOT make rotations thet means thad what if our triangle were ben rotatet from the CMERA we do not see it screen tays on z+ (or z-) and takes look an another side (this is CMERA SPACE)   Wm takes our verties from ObjectSpce to WorldSpace Vm takes our vertices from WorldSpace to ViewSpace - transfer vertices without rotation its (BILLBOARDING) but triangle must be already placed correctly Pm takes our vertices from ViewSpace to ScreenSpace
  • Advertisement