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.
2 changed files with 11 additions and 6 deletions
Showing only changes of commit e61f89ba11 - Show all commits

View File

@ -95,8 +95,15 @@ void LightData::init()
prim_type_ = prim_type(light); prim_type_ = prim_type(light);
write_shadow_params();
write_transform();
}
void LightData::write_shadow_params()
{
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

move this outside if

move this outside `if`
/* Shadow section, only Sunlight is supported. /* Shadow section, only Sunlight is supported.
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

rename shadow_params

rename `shadow_params`
we verified if any of light's shadow is turned on, if yes shadow task will be added*/ we verified if any of light's shadow is turned on, if yes shadow task will be added*/
Light *light = (Light *)((Object *)id)->data;
bool use_shadow = (light->mode & LA_SHADOW) && light->type == LA_SUN; bool use_shadow = (light->mode & LA_SHADOW) && light->type == LA_SUN;
scene_delegate_->shading_settings.use_storm_shadows |= use_shadow; scene_delegate_->shading_settings.use_storm_shadows |= use_shadow;
if (use_shadow) { if (use_shadow) {
@ -124,8 +131,6 @@ void LightData::init()
data_[pxr::HdLightTokens->shadowCollection] = pxr::HdRprimCollection( data_[pxr::HdLightTokens->shadowCollection] = pxr::HdRprimCollection(
pxr::HdTokens->geometry, pxr::HdReprSelector(pxr::HdReprTokens->refined)); pxr::HdTokens->geometry, pxr::HdReprSelector(pxr::HdReprTokens->refined));
} }
write_transform();
} }
void LightData::insert() void LightData::insert()
@ -145,9 +150,7 @@ void LightData::update()
Object *object = (Object *)id; Object *object = (Object *)id;
Light *light = (Light *)object->data; Light *light = (Light *)object->data;
pxr::HdDirtyBits bits = pxr::HdLight::Clean; pxr::HdDirtyBits bits = pxr::HdLight::Clean;
if (id->recalc & ID_RECALC_GEOMETRY || light->id.recalc & ID_RECALC_GEOMETRY || if (id->recalc & ID_RECALC_GEOMETRY || light->id.recalc & ID_RECALC_GEOMETRY) {
scene_delegate_->shading_settings.use_storm_shadows)
{
if (prim_type(light) != prim_type_) { if (prim_type(light) != prim_type_) {
remove(); remove();
init(); init();
@ -158,6 +161,7 @@ void LightData::update()
bits = pxr::HdLight::AllDirty; bits = pxr::HdLight::AllDirty;
} }
else if (id->recalc & ID_RECALC_TRANSFORM) { else if (id->recalc & ID_RECALC_TRANSFORM) {
write_shadow_params();
write_transform(); write_transform();
bits = pxr::HdLight::DirtyTransform; bits = pxr::HdLight::DirtyTransform;
} }

View File

@ -30,6 +30,7 @@ class LightData : public ObjectData {
void remove() override; void remove() override;
void update() override; void update() override;
void write_shadow_params();
pxr::VtValue get_data(pxr::TfToken const &key) const override; pxr::VtValue get_data(pxr::TfToken const &key) const override;
protected: protected: