@@ -30,17 +30,6 @@ PipelineShadow::PipelineShadow(
3030 renderPass_.CreateDepthOnlyRenderPass (ctx,
3131 RenderPassBit::DepthClear | RenderPassBit::DepthShaderReadOnly);
3232
33- /* framebuffer_.CreateUnresizeable(
34- ctx,
35- renderPass_.GetHandle(),
36- {
37- // Use the shadow map as depth attachment
38- resShadow_->shadowMap_.imageView_
39- },
40- resShadow_->shadowMap_.width_,
41- resShadow_->shadowMap_.height_);
42- */
43-
4433 for (uint32_t i = 0 ; i < ShadowConfig::CascadeCount; ++i)
4534 {
4635 cascadeFramebuffers_[i].CreateUnresizeable (
@@ -110,7 +99,7 @@ void PipelineShadow::CalculateCascade(
11099
111100 const glm::mat4 invCam = glm::inverse (camera->GetProjectionMatrix () * camera->GetViewMatrix ());
112101 const glm::vec3 normLightPos = normalize (glm::vec3 (light->position_ .x , light->position_ .y , light->position_ .z ));
113- // const float lightDist = glm::length(glm::vec3(light->pos ));
102+ const float lightDist = glm::length (glm::vec3 (light->position_ ));
114103 const float clipNear = CameraConfig::Near;
115104 const float clipFar = CameraConfig::Far;
116105 const float clipRange = clipFar - clipNear;
@@ -185,7 +174,7 @@ void PipelineShadow::CalculateCascade(
185174 -radius,
186175 radius,
187176 0 .f ,
188- clipFar );
177+ lightDist + radius );
189178
190179 // Store split distance and matrix in cascade
191180 ubo->lightSpaceMatrices [a] = lightOrthoMatrix * lightViewMatrix;
0 commit comments