Advertisement
Guest User

s

a guest
Aug 5th, 2015
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. cbuffer cbPerFrame
  2. {
  3. float3 gEyePosW;
  4. }
  5. cbuffer cbPerObject
  6. {
  7. float4x4 gWorld;
  8. float4x4 gWorldInvTranspose;
  9. float4x4 gViewProj;
  10. float4x4 gWorldViewProj;
  11. float4x4 gTexTransform;
  12. };
  13. Texture2D gDiffuseMap;
  14. SamplerState samLinear
  15. {
  16. Filter = MIN_MAG_MIP_LINEAR;
  17. AddressU = Wrap;
  18. AddressV = Wrap;
  19. };
  20.  
  21. struct VertexIn
  22. {
  23. float3 PosL : POSITION;
  24. float3 NormalL : NORMAL;
  25. float2 Tex : TEXCOORD;
  26. };
  27.  
  28. struct VertexOut
  29. {
  30. float4 PosH : SV_POSITION;
  31. float2 Tex : TEXCOORD;
  32. };
  33. VertexOut VS(VertexIn vin)
  34. {
  35. VertexOut vout;
  36.  
  37. vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);
  38. vout.Tex = mul(float4(vin.Tex, 0.0f, 1.0f), gTexTransform).xy;
  39.  
  40. return vout;
  41. }
  42. void PS(VertexOut pin)
  43. {
  44. float4 diffuse = gDiffuseMap.Sample(samLinear, pin.Tex);
  45.  
  46. // Don't write transparent pixels to the shadow map.
  47. clip(diffuse.a - 0.15f);
  48. }
  49. RasterizerState Depth
  50. {
  51. DepthBias = 10000;
  52. DepthBiasClamp = 0.0f;
  53. SlopeScaledDepthBias = 1.0f;
  54. };
  55.  
  56.  
  57. technique11 BuildShadowMapTech
  58. {
  59. pass P0
  60. {
  61. SetVertexShader( CompileShader( vs_4_0, VS() ) );
  62. SetGeometryShader( NULL );
  63. SetPixelShader( NULL );
  64.  
  65. SetRasterizerState(Depth);
  66. }
  67. }
  68.  
  69. technique11 BuildShadowMapAlphaClipTech
  70. {
  71. pass P0
  72. {
  73. SetVertexShader( CompileShader( vs_4_0, VS() ) );
  74. SetGeometryShader( NULL );
  75. SetPixelShader( CompileShader( ps_4_0, PS() ) );
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement