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 57bcfce620 - Show all commits

View File

@ -25,8 +25,6 @@ void LightData::init()
{ {
ID_LOG(2, ""); ID_LOG(2, "");
const float round_tolerance = 0.00001f;
Light *light = (Light *)((Object *)id)->data; Light *light = (Light *)((Object *)id)->data;
data_.clear(); data_.clear();
@ -35,14 +33,14 @@ void LightData::init()
switch (light->type) { switch (light->type) {
case LA_LOCAL: case LA_LOCAL:
if (light->radius > round_tolerance) { if (light->radius > FLT_EPSILON) { /* extremely small object should be considered as point */
data_[pxr::HdLightTokens->radius] = light->radius; data_[pxr::HdLightTokens->radius] = light->radius;
data_[pxr::HdLightTokens->normalize] = true; data_[pxr::HdLightTokens->normalize] = true;
} }
else { else {
data_[pxr::UsdLuxTokens->treatAsPoint] = true; data_[pxr::UsdLuxTokens->treatAsPoint] = true;
} }
intensity /= 40.0f; intensity /= 40.0f; /* coefficient approximated to follow RPR results */
break; break;
case LA_SUN: case LA_SUN:
@ -54,7 +52,7 @@ void LightData::init()
float(M_PI); float(M_PI);
data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend; data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend;
data_[pxr::UsdLuxTokens->treatAsPoint] = true; data_[pxr::UsdLuxTokens->treatAsPoint] = true;
intensity /= 10.0f; intensity /= 10.0f; /* coefficient approximated to follow RPR results */
break; break;
case LA_AREA: case LA_AREA:
@ -62,22 +60,22 @@ void LightData::init()
case LA_AREA_SQUARE: case LA_AREA_SQUARE:
data_[pxr::HdLightTokens->width] = light->area_size; data_[pxr::HdLightTokens->width] = light->area_size;
data_[pxr::HdLightTokens->height] = light->area_size; data_[pxr::HdLightTokens->height] = light->area_size;
intensity /= 4.0f; intensity /= 4.0f; /* coefficient approximated to follow RPR results */
break; break;
case LA_AREA_RECT: case LA_AREA_RECT:
data_[pxr::HdLightTokens->width] = light->area_size; data_[pxr::HdLightTokens->width] = light->area_size;
data_[pxr::HdLightTokens->height] = light->area_sizey; data_[pxr::HdLightTokens->height] = light->area_sizey;
intensity /= 4.0f; intensity /= 4.0f; /* coefficient approximated to follow RPR results */
break; break;
case LA_AREA_DISK: case LA_AREA_DISK:
data_[pxr::HdLightTokens->radius] = light->area_size / 2.0f; data_[pxr::HdLightTokens->radius] = light->area_size / 2.0f;
intensity /= 16.0f; intensity /= 16.0f; /* coefficient approximated to follow RPR results */
break; break;
case LA_AREA_ELLIPSE: case LA_AREA_ELLIPSE:
data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4.0f; data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4.0f;
intensity /= 16.0f; intensity /= 16.0f; /* coefficient approximated to follow RPR results */
break; break;
default: default: