Shadows go brrr

This commit is contained in:
2025-01-16 14:03:28 +01:00
parent 8a3bf57d7e
commit 071caf51b6
22 changed files with 4140 additions and 3269 deletions

View File

@@ -1,10 +1,6 @@
float4x4 gLightWorldViewProj : WorldViewProjection;
float4x4 gWorldViewProj: WorldViewProjection; //For compatibility sake
Texture2D gShadowMap : ShadowMap;
SamplerState gShadowMapSampler : ShadowMapSampler;
struct VS_Input {
float3 Position : POSITION;
float2 TexCoord : TEXCOORD;
@@ -27,14 +23,24 @@ VS_Output VS_Shadow(VS_Input input)
float4 PS_Shadow(VS_Output input) : SV_TARGET
{
// Output depth information (Z/W in clip space)
return float4(input.Position.z / input.Position.w, 0.0f, 0.0f, 1.0f);
// // gl_FragDepth = gl_FragCoord.z;
return float4(input.Position.z / input.Position.w, 0.0f, 0.0f, input.Position.z / input.Position.w);
}
// Rasterizer state for front face culling
RasterizerState FrontFaceCull
{
FrontCounterClockwise = FALSE;
CullMode = FRONT;
};
// Technique for rendering shadow map
technique11 DefaultTechnique
{
pass P0
{
//Set FrontFaceCulling
SetRasterizerState(FrontFaceCull);
SetVertexShader(CompileShader(vs_5_0, VS_Shadow()));
SetPixelShader(CompileShader(ps_5_0, PS_Shadow()));
}