forked from blender/blender
Need to do the same light power as Cycles in Watts for Hydra RPR #34
@ -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;
|
||||
Bogdan Nagirniak
commented
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;
|
||||
Bogdan Nagirniak
commented
if radius == 0, maybe if radius == 0, maybe `data_[pxr::UsdLuxTokens->treatAsPoint] = true;` ?
|
||||
}
|
||||
else {
|
||||
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
||||
}
|
||||
intensity /= 40.0f;
|
||||
Brian Savery (AMD)
commented
This seems like a strange value. How was this found? This seems like a strange value. How was this found?
Georgiy Markelov
commented
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;
|
||||
Bogdan Nagirniak
commented
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;
|
||||
}
|
||||
Bogdan Nagirniak
commented
Move this check to L125 and check 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user
the name here is strange. Maybe "radius_threshold". And please add a comment why.
use FLT_EPSILON
Changed round_tolerance -> FLT_EPSILON. Added comment.