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;

the name here is strange. Maybe "radius_threshold". And please add a comment why.

the name here is strange. Maybe "radius_threshold". And please add a comment why.

use FLT_EPSILON

use FLT_EPSILON

Changed round_tolerance -> FLT_EPSILON. Added comment.

Changed round_tolerance -> FLT_EPSILON. Added comment.
Light *light = (Light *)((Object *)id)->data;
data_.clear();
float intensity = light->energy;

Do we still need this multiplication?

Do we still need this multiplication?
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);
data_[pxr::HdLightTokens->normalize] = true;
if (light->radius > round_tolerance) {
data_[pxr::HdLightTokens->radius] = light->radius;
data_[pxr::HdLightTokens->normalize] = true;

if radius == 0, maybe data_[pxr::UsdLuxTokens->treatAsPoint] = true; ?

if radius == 0, maybe `data_[pxr::UsdLuxTokens->treatAsPoint] = true;` ?
}
else {
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
}
intensity /= 40.0f;

This seems like a strange value. How was this found?

This seems like a strange value. How was this found?

Every value has been found empirically.

Every value has been found empirically.
break;
@ -88,12 +91,10 @@ void LightData::init()
}
data_[pxr::HdLightTokens->intensity] = intensity;
data_[pxr::HdLightTokens->exposure] = 0.0f;

Remove this TODO

Remove this TODO
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;
}

Move this check to L125 and check light->id.recalc & ID_RECALC_GEOMETRY

Move this check to L125 and check `light->id.recalc & ID_RECALC_GEOMETRY`
else if (id->recalc & ID_RECALC_COPY_ON_WRITE) {
init();
bits = pxr::HdLight::AllDirty;
}
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(prim_id, bits);
}