ADD: CSM with base shadow map

This commit is contained in:
2025-10-21 21:24:35 +09:00
parent 3b7f0869a2
commit fde6a18f80
6 changed files with 154 additions and 47 deletions

View File

@@ -18,12 +18,16 @@ layout(buffer_reference, std430) readonly buffer VertexBuffer{
layout(push_constant) uniform PushConsts {
mat4 render_matrix;
VertexBuffer vertexBuffer;
uint cascadeIndex; // which cascade this pass renders
// pad to 16-byte boundary implicitly
} PC;
void main()
{
Vertex v = PC.vertexBuffer.vertices[gl_VertexIndex];
vec4 worldPos = PC.render_matrix * vec4(v.position, 1.0);
gl_Position = sceneData.lightViewProj * worldPos;
// Use cascaded matrix; cascade 0 is the legacy near/simple map
uint ci = min(PC.cascadeIndex, uint(3));
gl_Position = sceneData.lightViewProjCascades[ci] * worldPos;
}