Need to do the same light power as Cycles in Watts for Hydra RPR #34

Merged
Bogdan Nagirniak merged 12 commits from BLEN-386 into hydra-render 2023-05-05 08:42:35 +02:00
Showing only changes of commit 0b5e6c9d54 - Show all commits

View File

@ -25,20 +25,23 @@ void LightData::init()
{
ID_LOG(2, "");
const float round_tolerance = 0.00001f;
Light *light = (Light *)((Object *)id)->data;
data_.clear();
float intensity = light->energy;
if (scene_delegate_->engine_type == BlenderSceneDelegate::EngineType::PREVIEW) {
intensity *= 0.001f;
}
data_[pxr::HdLightTokens->color] = pxr::GfVec3f(light->r, light->g, light->b);
switch (light->type) {
case LA_LOCAL:
data_[pxr::HdLightTokens->radius] = std::max(light->radius, 0.000001f);
if (light->radius > round_tolerance) {
data_[pxr::HdLightTokens->radius] = light->radius;
data_[pxr::HdLightTokens->normalize] = true;
}
else {
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
}
intensity /= 40.0f;
break;
@ -88,12 +91,10 @@ void LightData::init()
}
data_[pxr::HdLightTokens->intensity] = intensity;
data_[pxr::HdLightTokens->exposure] = 0.0f;
prim_type_ = prim_type(light);
/* TODO: temporary value, it should be delivered through Python UI */
data_[pxr::HdLightTokens->exposure] = 0.0f;
write_transform();
}
@ -122,7 +123,7 @@ void LightData::update()
}
pxr::HdDirtyBits bits = pxr::HdLight::Clean;
if (id->recalc & ID_RECALC_GEOMETRY) {
if (id->recalc & ID_RECALC_GEOMETRY || light->id.recalc & ID_RECALC_GEOMETRY) {
init();
bits = pxr::HdLight::AllDirty;
}
@ -130,10 +131,6 @@ void LightData::update()
write_transform();
bits = pxr::HdLight::DirtyTransform;
}
else if (id->recalc & ID_RECALC_COPY_ON_WRITE) {
init();
bits = pxr::HdLight::AllDirty;
}
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(prim_id, bits);
}