WIP Make shadows visible for Storm delegate #80

Closed
Vasyl Pidhirskyi wants to merge 16 commits from Vasyl-Pidhirskyi/blender_bn:BLEN-469 into hydra-render

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 479b8be3ef - Show all commits

View File

@ -101,26 +101,26 @@ void LightData::init()
scene_delegate_->shading_settings.use_storm_shadows |= use_shadow;
if (use_shadow) {
data_[pxr::HdLightTokens->hasShadow] = use_shadow;
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

move this outside if

move this outside `if`
pxr::HdxShadowParams shadowParams_ = pxr::HdxShadowParams();
pxr::HdxShadowParams shadow_params = pxr::HdxShadowParams();
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

rename shadow_params

rename `shadow_params`
/* ShadowMatrix class is used to calculates shadow matrix from light frustum.*/
ShadowMatrix *shadowMatrix = new ShadowMatrix();
shadowMatrix->SetNearFar(0.1, light->cascade_max_dist);
shadowMatrix->SetTransform(gf_matrix_from_transform(((Object *)id)->object_to_world));
ShadowMatrix *shadow_matrix = new ShadowMatrix();
shadow_matrix->SetNearFar(0.1, light->cascade_max_dist);
shadow_matrix->SetTransform(gf_matrix_from_transform(((Object *)id)->object_to_world));
/* SetWindow sets size of projected shadow texture texture in
the approximate value is calculated using sun_angle property
180 degrees is window size 1000 by 1000 */
shadowMatrix->SetWindow(static_cast<int>(light->sun_angle * 0.5f / M_PI * 1000),
shadow_matrix->SetWindow(static_cast<int>(light->sun_angle * 0.5f / M_PI * 1000),
static_cast<int>(light->sun_angle * 0.5f / M_PI * 1000));
shadowMatrix->CalculateMatrix();
shadowParams_.enabled = use_shadow;
shadowParams_.resolution = scene_delegate_->scene->eevee.shadow_cascade_size;
shadowParams_.shadowMatrix = pxr::HdxShadowMatrixComputationSharedPtr(shadowMatrix);
shadowParams_.bias = -1.0 * light->bias;
shadowParams_.blur = light->cascade_fade;
shadow_matrix->CalculateMatrix();
shadow_params.enabled = use_shadow;
shadow_params.resolution = scene_delegate_->scene->eevee.shadow_cascade_size;
shadow_params.shadowMatrix = pxr::HdxShadowMatrixComputationSharedPtr(shadow_matrix);
shadow_params.bias = -1.0 * light->bias;
shadow_params.blur = light->cascade_fade;
data_[pxr::HdLightTokens->shadowParams] = shadowParams_;
data_[pxr::HdLightTokens->shadowParams] = shadow_params;
data_[pxr::HdLightTokens->shadowCollection] = pxr::HdRprimCollection(
pxr::HdTokens->geometry, pxr::HdReprSelector(pxr::HdReprTokens->refined));
}
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

Move whole block to write_shadow_params()

Move whole block to `write_shadow_params()`