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, "");
const float round_tolerance = 0.00001f;
Light *light = (Light *)((Object *)id)->data;

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.
data_.clear();
@ -35,14 +33,14 @@ void LightData::init()

Do we still need this multiplication?

Do we still need this multiplication?
switch (light->type) {
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->normalize] = true;
}
else {

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

if radius == 0, maybe `data_[pxr::UsdLuxTokens->treatAsPoint] = true;` ?
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
}
intensity /= 40.0f;
intensity /= 40.0f; /* coefficient approximated to follow RPR results */
break;

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.
case LA_SUN:
@ -54,7 +52,7 @@ void LightData::init()
float(M_PI);
data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend;
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
intensity /= 10.0f;
intensity /= 10.0f; /* coefficient approximated to follow RPR results */
break;
case LA_AREA:
@ -62,22 +60,22 @@ void LightData::init()
case LA_AREA_SQUARE:
data_[pxr::HdLightTokens->width] = light->area_size;
data_[pxr::HdLightTokens->height] = light->area_size;
intensity /= 4.0f;
intensity /= 4.0f; /* coefficient approximated to follow RPR results */
break;
case LA_AREA_RECT:
data_[pxr::HdLightTokens->width] = light->area_size;
data_[pxr::HdLightTokens->height] = light->area_sizey;
intensity /= 4.0f;
intensity /= 4.0f; /* coefficient approximated to follow RPR results */
break;
case LA_AREA_DISK:
data_[pxr::HdLightTokens->radius] = light->area_size / 2.0f;
intensity /= 16.0f;
intensity /= 16.0f; /* coefficient approximated to follow RPR results */
break;
case LA_AREA_ELLIPSE:
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;
default: