Adjusted bias

This commit is contained in:
Olivier Prat 2017-10-26 17:41:54 +02:00
parent 5d83284ac5
commit 44393f12d9
3 changed files with 6 additions and 5 deletions

View file

@ -76,9 +76,10 @@ void LightStage::Shadow::setKeylightFrustum(const ViewFrustum& viewFrustum,
fitFrustum(farCorners.topLeft);
fitFrustum(farCorners.topRight);
// Re-adjust near shadow distance to
max.z = glm::max(max.z, -nearDepth);
glm::mat4 ortho = glm::ortho<float>(min.x, max.x, min.y, max.y, -max.z, -min.z);
// Re-adjust near shadow distance
auto near = glm::max(max.z, -nearDepth);
auto far = -min.z;
glm::mat4 ortho = glm::ortho<float>(min.x, max.x, min.y, max.y, near, far);
_frustum->setProjection(ortho);
// Calculate the frustum's internal state

View file

@ -69,7 +69,7 @@ public:
glm::mat4 projection;
glm::mat4 viewInverse;
glm::float32 bias = 0.005f;
glm::float32 bias = 0.003f;
glm::float32 scale = 1 / MAP_SIZE;
};
UniformBufferView _schemaBuffer = nullptr;

View file

@ -203,7 +203,7 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con
}
void RenderShadowTask::build(JobModel& task, const render::Varying& input, render::Varying& output, CullFunctor cullFunctor) {
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&) { return true; };
// Prepare the ShapePipeline
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();