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/imaging/hd/tokens.h>
|
||||||
#include <pxr/usd/usdLux/tokens.h>
|
#include <pxr/usd/usdLux/tokens.h>
|
||||||
|
|
||||||
|
#include "BLI_math_rotation.h"
|
||||||
#include "DNA_light_types.h"
|
#include "DNA_light_types.h"
|
||||||
|
|
||||||
#include "blender_scene_delegate.h"
|
#include "blender_scene_delegate.h"
|
||||||
@ -33,26 +34,26 @@ void LightData::init()
|
|||||||
|
|
||||||
switch (light->type) {
|
switch (light->type) {
|
||||||
case LA_LOCAL:
|
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->radius] = light->radius;
|
||||||
data_[pxr::HdLightTokens->normalize] = true;
|
data_[pxr::HdLightTokens->normalize] = true;
|
||||||
}
|
}
|
||||||
else {
|
intensity /= 40.0f; /* coefficient approximated to follow Cycles results */
|
||||||
data_[pxr::UsdLuxTokens->treatAsPoint] = true;
|
|
||||||
}
|
|
||||||
intensity /= 40.0f; /* coefficient approximated to follow RPR results */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_SUN:
|
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;
|
break;
|
||||||
|
|
||||||
case LA_SPOT:
|
case LA_SPOT:
|
||||||
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = light->spotsize / 2.0f * 180.0f /
|
data_[pxr::UsdLuxTokens->inputsShapingConeAngle] = RAD2DEGF(light->spotsize * 0.5f);
|
||||||
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; /* coefficient approximated to follow RPR results */
|
intensity /= 10.0f; /* coefficient approximated to follow Cycles results */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LA_AREA:
|
case LA_AREA:
|
||||||
@ -60,22 +61,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; /* coefficient approximated to follow RPR results */
|
intensity /= 4.0f; /* coefficient approximated to follow Cycles 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; /* coefficient approximated to follow RPR results */
|
intensity /= 4.0f; /* coefficient approximated to follow Cycles 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; /* coefficient approximated to follow RPR results */
|
intensity /= 16.0f; /* coefficient approximated to follow Cycles 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; /* coefficient approximated to follow RPR results */
|
intensity /= 16.0f; /* coefficient approximated to follow Cycles results */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user