forked from blender/blender
Need to do the same light power as Cycles in Watts for Hydra RPR #34
@ -7,6 +7,7 @@
|
||||
#include <pxr/imaging/hd/tokens.h>
|
||||
#include <pxr/usd/usdLux/tokens.h>
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "DNA_light_types.h"
|
||||
|
||||
#include "blender_scene_delegate.h"
|
||||
@ -33,26 +34,26 @@ void LightData::init()
|
||||
|
||||
switch (light->type) {
|
||||
case LA_LOCAL:
|
||||
if (light->radius > FLT_EPSILON) { /* extremely small object should be considered as point */
|
||||
if (light->radius <= FLT_EPSILON) {
|
||||
/* extremely small object should be considered as point */
|
||||
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
||||
}
|
||||
|
||||
else {
|
||||
data_[pxr::HdLightTokens->radius] = light->radius;
|
||||
data_[pxr::HdLightTokens->normalize] = true;
|
||||
}
|
||||
else {
|
||||
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
||||
}
|
||||
intensity /= 40.0f; /* coefficient approximated to follow RPR results */
|
||||
intensity /= 40.0f; /* coefficient approximated to follow Cycles results */
|
||||
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;
|
||||
|
||||
case LA_SUN:
|
||||
data_[pxr::HdLightTokens->angle] = light->sun_angle * 180.0f / float(M_PI);
|
||||
data_[pxr::HdLightTokens->angle] = RAD2DEGF(light->sun_angle * 0.5f);
|
||||
break;
|
||||
|
||||
case LA_SPOT:
|
||||
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = light->spotsize / 2.0f * 180.0f /
|
||||
float(M_PI);
|
||||
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = RAD2DEGF(light->spotsize * 0.5f);
|
||||
data_[pxr::UsdLuxTokens->inputsShapingConeSoftness] = light->spotblend;
|
||||
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
||||
intensity /= 10.0f; /* coefficient approximated to follow RPR results */
|
||||
intensity /= 10.0f; /* coefficient approximated to follow Cycles results */
|
||||
break;
|
||||
|
||||
case LA_AREA:
|
||||
@ -60,22 +61,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; /* coefficient approximated to follow RPR results */
|
||||
intensity /= 4.0f; /* coefficient approximated to follow Cycles results */
|
||||
break;
|
||||
case LA_AREA_RECT:
|
||||
data_[pxr::HdLightTokens->width] = light->area_size;
|
||||
data_[pxr::HdLightTokens->height] = light->area_sizey;
|
||||
intensity /= 4.0f; /* coefficient approximated to follow RPR results */
|
||||
intensity /= 4.0f; /* coefficient approximated to follow Cycles results */
|
||||
break;
|
||||
|
||||
case LA_AREA_DISK:
|
||||
data_[pxr::HdLightTokens->radius] = light->area_size / 2.0f;
|
||||
intensity /= 16.0f; /* coefficient approximated to follow RPR results */
|
||||
intensity /= 16.0f; /* coefficient approximated to follow Cycles results */
|
||||
break;
|
||||
|
||||
case LA_AREA_ELLIPSE:
|
||||
data_[pxr::HdLightTokens->radius] = (light->area_size + light->area_sizey) / 4.0f;
|
||||
intensity /= 16.0f; /* coefficient approximated to follow RPR results */
|
||||
intensity /= 16.0f; /* coefficient approximated to follow Cycles results */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user
if radius == 0, maybe
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
?