Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cbuffer cbPerFrame
- {
- float3 gEyePosW;
- }
- cbuffer cbPerObject
- {
- float4x4 gWorld;
- float4x4 gWorldInvTranspose;
- float4x4 gViewProj;
- float4x4 gWorldViewProj;
- float4x4 gTexTransform;
- };
- Texture2D gDiffuseMap;
- SamplerState samLinear
- {
- Filter = MIN_MAG_MIP_LINEAR;
- AddressU = Wrap;
- AddressV = Wrap;
- };
- struct VertexIn
- {
- float3 PosL : POSITION;
- float3 NormalL : NORMAL;
- float2 Tex : TEXCOORD;
- };
- struct VertexOut
- {
- float4 PosH : SV_POSITION;
- float2 Tex : TEXCOORD;
- };
- VertexOut VS(VertexIn vin)
- {
- VertexOut vout;
- vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);
- vout.Tex = mul(float4(vin.Tex, 0.0f, 1.0f), gTexTransform).xy;
- return vout;
- }
- void PS(VertexOut pin)
- {
- float4 diffuse = gDiffuseMap.Sample(samLinear, pin.Tex);
- // Don't write transparent pixels to the shadow map.
- clip(diffuse.a - 0.15f);
- }
- RasterizerState Depth
- {
- DepthBias = 10000;
- DepthBiasClamp = 0.0f;
- SlopeScaledDepthBias = 1.0f;
- };
- technique11 BuildShadowMapTech
- {
- pass P0
- {
- SetVertexShader( CompileShader( vs_4_0, VS() ) );
- SetGeometryShader( NULL );
- SetPixelShader( NULL );
- SetRasterizerState(Depth);
- }
- }
- technique11 BuildShadowMapAlphaClipTech
- {
- pass P0
- {
- SetVertexShader( CompileShader( vs_4_0, VS() ) );
- SetGeometryShader( NULL );
- SetPixelShader( CompileShader( ps_4_0, PS() ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement