mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-19 14:03:20 +02:00
Fit shadowmap to viewFrustum better
This commit is contained in:
parent
2b27e48bf9
commit
b2c9cf7452
2 changed files with 2 additions and 3 deletions
|
@ -21,7 +21,7 @@ LightStage::Shadow::Shadow(model::LightPointer light) : _light{ light}, _frustum
|
|||
}
|
||||
|
||||
void LightStage::Shadow::setKeylightFrustum(ViewFrustum* viewFrustum, float nearDepth, float farDepth) {
|
||||
assert(nearDepth >= 0 && farDepth > 0);
|
||||
assert(nearDepth < farDepth);
|
||||
|
||||
// Orient the keylight frustum
|
||||
const auto& direction = glm::normalize(_light->getDirection());
|
||||
|
|
|
@ -115,8 +115,7 @@ void RenderShadowTask::run(const SceneContextPointer& sceneContext, const Render
|
|||
auto nearClip = viewFrustum->getNearClip();
|
||||
const int SHADOW_NEAR_DEPTH = -1;
|
||||
const int SHADOW_FAR_DEPTH = 20;
|
||||
globalLight->shadow.setKeylightFrustum(viewFrustum,
|
||||
glm::max(0.0f, nearClip - SHADOW_NEAR_DEPTH), nearClip + SHADOW_FAR_DEPTH);
|
||||
globalLight->shadow.setKeylightFrustum(viewFrustum, nearClip + SHADOW_NEAR_DEPTH, nearClip + SHADOW_FAR_DEPTH);
|
||||
|
||||
// Set the keylight frustum
|
||||
args->_viewFrustum = globalLight->shadow.getFrustum().get();
|
||||
|
|
Loading…
Reference in a new issue