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 0bd2c69cbc - Show all commits

View File

@ -30,23 +30,24 @@ void LightData::init()
float intensity = light->energy;
if (scene_delegate_->engine_type == BlenderSceneDelegate::EngineType::PREVIEW) {
intensity *= 0.001;
intensity *= 0.001f;

Do we still need this multiplication?

Do we still need this multiplication?
}
data_[pxr::HdLightTokens->intensity] = intensity;
//intensity *= 0.001f;
data_[pxr::HdLightTokens->color] = pxr::GfVec3f(light->r, light->g, light->b);
switch (light->type) {
case LA_LOCAL:

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

if radius == 0, maybe `data_[pxr::UsdLuxTokens->treatAsPoint] = true;` ?
data_[pxr::HdLightTokens->radius] = light->area_size / 2;
data_[pxr::HdLightTokens->radius] = light->radius;
data_[pxr::HdLightTokens->normalize] = true;
break;
case LA_SUN:

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.
data_[pxr::HdLightTokens->angle] = light->sun_angle * 180.0 / M_PI;
data_[pxr::HdLightTokens->angle] = light->sun_angle * 180.0f / float(M_PI);
break;
case LA_SPOT:
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = (float)(light->spotsize / 2.0f * 180.0f / M_PI);
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = light->spotsize / 2.0f * 180.0f / float(M_PI);
data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend;
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
break;
@ -63,11 +64,13 @@ void LightData::init()
break;
case LA_AREA_DISK:
data_[pxr::HdLightTokens->radius] = light->area_size / 2;
data_[pxr::HdLightTokens->radius] = light->area_size / 2.0f;
intensity /= 2.0f;
break;
case LA_AREA_ELLIPSE:
data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4;
data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4.0f;
intensity /= 2.0f;
break;
default:
@ -80,6 +83,8 @@ void LightData::init()
break;
}
data_[pxr::HdLightTokens->intensity] = intensity;
prim_type_ = prim_type(light);
/* TODO: temporary value, it should be delivered through Python UI */
@ -146,6 +151,7 @@ pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
}
}
}
std::cout << key.GetString() << " " << ret << " " << ret.IsHolding<float>() << "\n";
return ret;
}