Showing the changes to libraries/render-utils/src/RenderShadowTask.cpp (1 of 5 files). Show all
Unified · Split
| @@ -33,6 +33,8 @@ · 32 unmodified lines | ||
| 33 | 33 | // but are readjusted afterwards |
| 34 | 34 | #define SHADOW_FRUSTUM_NEAR 1.0f |
| 35 | 35 | #define SHADOW_FRUSTUM_FAR 500.0f |
| 36 | +static const unsigned int SHADOW_CASCADE_COUNT{ 4 }; | |
| 37 | +static const float SHADOW_MAX_DISTANCE{ 40.0f }; | |
| 36 | 38 | |
| 37 | 39 | using namespace render; |
| 38 | 40 | |
| @@ -62,8 +64,6 @@ void RenderShadowTask::build(JobModel& task, const render::Varying& input, rende · 23 unmodified lines | ||
| 62 | 64 | |
| 63 | 65 | const auto& lightFrame = input.getN<Input>(0); |
| 64 | 66 | |
| 65 | − const auto& lightingModel = input.getN<Input>(1); | |
| 66 | − | |
| 67 | 67 | const auto setupOutput = task.addJob<RenderShadowSetup>("ShadowSetup", input); |
| 68 | 68 | const auto queryResolution = setupOutput.getN<RenderShadowSetup::Output>(1); |
| 69 | 69 | const auto shadowFrame = setupOutput.getN<RenderShadowSetup::Output>(3); |
| @@ -371,7 +371,7 @@ void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, c · 301 unmodified lines | ||
| 371 | 371 | output.edit2() = _cameraFrustum; |
| 372 | 372 | |
| 373 | 373 | if (!_globalShadowObject) { |
| 374 | − _globalShadowObject = std::make_shared<LightStage::Shadow>(graphics::LightPointer(), 100.f, 4); | |
| 374 | + _globalShadowObject = std::make_shared<LightStage::Shadow>(graphics::LightPointer(), SHADOW_MAX_DISTANCE, SHADOW_CASCADE_COUNT); | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | const auto theGlobalLight = lightStage->getCurrentKeyLight(lightFrame); |
| @@ -446,19 +446,13 @@ void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, c · 68 unmodified lines | ||
| 446 | 446 | |
| 447 | 447 | void RenderShadowCascadeSetup::run(const render::RenderContextPointer& renderContext, const Inputs& input, Outputs& output) { |
| 448 | 448 | const auto shadowFrame = input; |
| 449 | − /* | |
| 450 | − auto lightStage = renderContext->_scene->getStage<LightStage>(); | |
| 451 | − const auto& lightFrame = *input; | |
| 452 | − assert(lightStage); | |
| 453 | −*/ | |
| 449 | + | |
| 454 | 450 | // Cache old render args |
| 455 | 451 | RenderArgs* args = renderContext->args; |
| 456 | 452 | |
| 457 | 453 | RenderShadowTask::CullFunctor cullFunctor; |
| 458 | − | |
| 459 | − | |
| 460 | 454 | if (shadowFrame && !shadowFrame->_objects.empty() && shadowFrame->_objects[0]) { |
| 461 | − const auto globalShadow = shadowFrame->_objects[0]; //lightStage->getCurrentKeyShadow(lightFrame); | |
| 455 | + const auto globalShadow = shadowFrame->_objects[0]; | |
| 462 | 456 | |
| 463 | 457 | if (globalShadow && _cascadeIndex < globalShadow->getCascadeCount()) { |
| 464 | 458 | // Second item filter is to filter items to keep in shadow frustum computation (here we need to keep shadow receivers) |