Skip to content

Commit

Permalink
Photometric light params should override spot shaping (#1397)
Browse files Browse the repository at this point in the history
* Photometric light params should override spot shaping #1316

* Photometric path should override cone angle in the procedural too #1316
  • Loading branch information
sebastienblor authored Jan 23, 2023
1 parent 13ac513 commit 9a7ef6c
Show file tree
Hide file tree
Showing 7 changed files with 426 additions and 8 deletions.
11 changes: 9 additions & 2 deletions render_delegate/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ AtString getLightType(HdSceneDelegate* delegate, const SdfPath& id)
}
return false;
};
// If any of the shaping params exists or non-default we have a spot light.
// USD can have a light with spot shaping + photometric IES profile, but arnold
// doesn't support both together. Here we first check if a IES Path is set (#1316),
// and if so we translate this as an arnold photometric light (which won't have any spot cone).
if (hasIesFile())
return str::photometric_light;

// Then, if any of the shaping params exists or non-default we have a spot light.
#if PXR_VERSION >= 2105
if (!isDefault(UsdLuxTokens->inputsShapingFocus, 0.0f) ||
!isDefault(UsdLuxTokens->inputsShapingConeAngle, 180.0f) ||
Expand All @@ -208,7 +214,8 @@ AtString getLightType(HdSceneDelegate* delegate, const SdfPath& id)
#endif
return str::spot_light;
}
return hasIesFile() ? str::photometric_light : str::point_light;
// Finally, we default to a point light
return str::point_light;
}

auto spotLightSync = [](AtNode* light, AtNode** filter, const AtNodeEntry* nentry, const SdfPath& id,
Expand Down
7 changes: 7 additions & 0 deletions testsuite/test_1316/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Photometric lights should override cone shaping attributes

Fixes #1316

author: sebastien.ortega

PARAMS: {'scene':'test.usda'}
13 changes: 13 additions & 0 deletions testsuite/test_1316/data/light.ies
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
IESNA:LM-63-1995
[TEST] BE1667
[DATE] 12-FEB-96
[MANUFAC] BEGA
[LUMCAT] 6339
[LUMINAIRE] SURFACE MOUNTED WALL LUMINAIRE
[LAMP] (1) 60W A-19 INC
TILT=NONE
1 890 .89 73 1 1 2 -.1 0 0
1 1 60
0 2.5 5 7.5 10 12.5 15 17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50 52.5 55 57.5 60 62.5 65 67.5 70 72.5 75 77.5 80 82.5 85 87.5 90 92.5 95 97.5 100 102.5 105 107.5 110 112.5 115 117.5 120 122.5 125 127.5 130 132.5 135 137.5 140 142.5 145 147.5 150 152.5 155 157.5 160 162.5 165 167.5 170 172.5 175 177.5 180
0
178.4 176.7 170.8 160.9 147 133 114.6 96.13 80.57 67.13 56.54 47.61 40.87 36.97 36.86 39.76 45.47 54.35 66.39 75.84 79.96 73.53 62.87 52.35 44.33 39.14 36.31 33.87 29.1 22.59 15.67 9.13 5.317 2.654 1.382 .3416 .2 .09695 .2025 .175 .1518 .1455 .1328 .1307 .1139 .1097 .097 .1075 .1076 .07175 .1243 .1073 .1328 .1349 .1391 .1307 .1412 .1475 .156 .1813 .1876 .2087 .2466 .2466 .2782 .2993 .3035 .3035 .3035 .2993 .2993 .3035 .3035
178 changes: 178 additions & 0 deletions testsuite/test_1316/data/test.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
#usda 1.0
(
defaultPrim = "grid1"
endTimeCode = 1
framesPerSecond = 24
metersPerUnit = 1
startTimeCode = 1
timeCodesPerSecond = 24
upAxis = "Y"
)

def Xform "grid1" (
prepend apiSchemas = ["MaterialBindingAPI"]
kind = "component"
)
{
rel material:binding = </materials/arnold_materialbuilder1>
matrix4d xformOp:transform:xform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform:xform"]

def Mesh "mesh_0"
{
float3[] extent = [(-5, 0, -5), (5, 0, 5)]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 11, 10, 1, 2, 12, 11, 2, 3, 13, 12, 3, 4, 14, 13, 4, 5, 15, 14, 5, 6, 16, 15, 6, 7, 17, 16, 7, 8, 18, 17, 8, 9, 19, 18, 10, 11, 21, 20, 11, 12, 22, 21, 12, 13, 23, 22, 13, 14, 24, 23, 14, 15, 25, 24, 15, 16, 26, 25, 16, 17, 27, 26, 17, 18, 28, 27, 18, 19, 29, 28, 20, 21, 31, 30, 21, 22, 32, 31, 22, 23, 33, 32, 23, 24, 34, 33, 24, 25, 35, 34, 25, 26, 36, 35, 26, 27, 37, 36, 27, 28, 38, 37, 28, 29, 39, 38, 30, 31, 41, 40, 31, 32, 42, 41, 32, 33, 43, 42, 33, 34, 44, 43, 34, 35, 45, 44, 35, 36, 46, 45, 36, 37, 47, 46, 37, 38, 48, 47, 38, 39, 49, 48, 40, 41, 51, 50, 41, 42, 52, 51, 42, 43, 53, 52, 43, 44, 54, 53, 44, 45, 55, 54, 45, 46, 56, 55, 46, 47, 57, 56, 47, 48, 58, 57, 48, 49, 59, 58, 50, 51, 61, 60, 51, 52, 62, 61, 52, 53, 63, 62, 53, 54, 64, 63, 54, 55, 65, 64, 55, 56, 66, 65, 56, 57, 67, 66, 57, 58, 68, 67, 58, 59, 69, 68, 60, 61, 71, 70, 61, 62, 72, 71, 62, 63, 73, 72, 63, 64, 74, 73, 64, 65, 75, 74, 65, 66, 76, 75, 66, 67, 77, 76, 67, 68, 78, 77, 68, 69, 79, 78, 70, 71, 81, 80, 71, 72, 82, 81, 72, 73, 83, 82, 73, 74, 84, 83, 74, 75, 85, 84, 75, 76, 86, 85, 76, 77, 87, 86, 77, 78, 88, 87, 78, 79, 89, 88, 80, 81, 91, 90, 81, 82, 92, 91, 82, 83, 93, 92, 83, 84, 94, 93, 84, 85, 95, 94, 85, 86, 96, 95, 86, 87, 97, 96, 87, 88, 98, 97, 88, 89, 99, 98]
uniform token orientation = "leftHanded"
point3f[] points = [(-5, 0, -5), (-3.8888888, 0, -5), (-2.7777777, 0, -5), (-1.6666665, 0, -5), (-0.55555534, 0, -5), (0.5555558, 0, -5), (1.666667, 0, -5), (2.7777781, 0, -5), (3.8888893, 0, -5), (5, 0, -5), (-5, 0, -3.8888888), (-3.8888888, 0, -3.8888888), (-2.7777777, 0, -3.8888888), (-1.6666665, 0, -3.8888888), (-0.55555534, 0, -3.8888888), (0.5555558, 0, -3.8888888), (1.666667, 0, -3.8888888), (2.7777781, 0, -3.8888888), (3.8888893, 0, -3.8888888), (5, 0, -3.8888888), (-5, 0, -2.7777777), (-3.8888888, 0, -2.7777777), (-2.7777777, 0, -2.7777777), (-1.6666665, 0, -2.7777777), (-0.55555534, 0, -2.7777777), (0.5555558, 0, -2.7777777), (1.666667, 0, -2.7777777), (2.7777781, 0, -2.7777777), (3.8888893, 0, -2.7777777), (5, 0, -2.7777777), (-5, 0, -1.6666665), (-3.8888888, 0, -1.6666665), (-2.7777777, 0, -1.6666665), (-1.6666665, 0, -1.6666665), (-0.55555534, 0, -1.6666665), (0.5555558, 0, -1.6666665), (1.666667, 0, -1.6666665), (2.7777781, 0, -1.6666665), (3.8888893, 0, -1.6666665), (5, 0, -1.6666665), (-5, 0, -0.55555534), (-3.8888888, 0, -0.55555534), (-2.7777777, 0, -0.55555534), (-1.6666665, 0, -0.55555534), (-0.55555534, 0, -0.55555534), (0.5555558, 0, -0.55555534), (1.666667, 0, -0.55555534), (2.7777781, 0, -0.55555534), (3.8888893, 0, -0.55555534), (5, 0, -0.55555534), (-5, 0, 0.5555558), (-3.8888888, 0, 0.5555558), (-2.7777777, 0, 0.5555558), (-1.6666665, 0, 0.5555558), (-0.55555534, 0, 0.5555558), (0.5555558, 0, 0.5555558), (1.666667, 0, 0.5555558), (2.7777781, 0, 0.5555558), (3.8888893, 0, 0.5555558), (5, 0, 0.5555558), (-5, 0, 1.666667), (-3.8888888, 0, 1.666667), (-2.7777777, 0, 1.666667), (-1.6666665, 0, 1.666667), (-0.55555534, 0, 1.666667), (0.5555558, 0, 1.666667), (1.666667, 0, 1.666667), (2.7777781, 0, 1.666667), (3.8888893, 0, 1.666667), (5, 0, 1.666667), (-5, 0, 2.7777781), (-3.8888888, 0, 2.7777781), (-2.7777777, 0, 2.7777781), (-1.6666665, 0, 2.7777781), (-0.55555534, 0, 2.7777781), (0.5555558, 0, 2.7777781), (1.666667, 0, 2.7777781), (2.7777781, 0, 2.7777781), (3.8888893, 0, 2.7777781), (5, 0, 2.7777781), (-5, 0, 3.8888893), (-3.8888888, 0, 3.8888893), (-2.7777777, 0, 3.8888893), (-1.6666665, 0, 3.8888893), (-0.55555534, 0, 3.8888893), (0.5555558, 0, 3.8888893), (1.666667, 0, 3.8888893), (2.7777781, 0, 3.8888893), (3.8888893, 0, 3.8888893), (5, 0, 3.8888893), (-5, 0, 5), (-3.8888888, 0, 5), (-2.7777777, 0, 5), (-1.6666665, 0, 5), (-0.55555534, 0, 5), (0.5555558, 0, 5), (1.666667, 0, 5), (2.7777781, 0, 5), (3.8888893, 0, 5), (5, 0, 5)] (
interpolation = "vertex"
)
uniform token subdivisionScheme = "none"
}
}

def Scope "materials"
{
def Material "arnold_materialbuilder1"
{
token outputs:arnold:surface.connect = </materials/arnold_materialbuilder1/standard_surface1.outputs:shader>

def Shader "standard_surface1"
{
uniform token info:id = "arnold:standard_surface"
string inputs:aov_id1 = ""
string inputs:aov_id2 = ""
string inputs:aov_id3 = ""
string inputs:aov_id4 = ""
string inputs:aov_id5 = ""
string inputs:aov_id6 = ""
string inputs:aov_id7 = ""
string inputs:aov_id8 = ""
float inputs:base = 1
color3f inputs:base_color = (0.8, 0.8, 0.8)
bool inputs:caustics = 0
float inputs:coat = 0
float inputs:coat_affect_color = 0
float inputs:coat_affect_roughness = 0
float inputs:coat_anisotropy = 0
color3f inputs:coat_color = (1, 1, 1)
float inputs:coat_IOR = 1.5
vector3f inputs:coat_normal = (0, 0, 0)
float inputs:coat_rotation = 0
float inputs:coat_roughness = 0.1
int inputs:dielectric_priority = 0
float inputs:diffuse_roughness = 0
float inputs:emission = 0
color3f inputs:emission_color = (1, 1, 1)
bool inputs:exit_to_background = 0
color3f inputs:id1 = (0, 0, 0)
color3f inputs:id2 = (0, 0, 0)
color3f inputs:id3 = (0, 0, 0)
color3f inputs:id4 = (0, 0, 0)
color3f inputs:id5 = (0, 0, 0)
color3f inputs:id6 = (0, 0, 0)
color3f inputs:id7 = (0, 0, 0)
color3f inputs:id8 = (0, 0, 0)
float inputs:indirect_diffuse = 1
float inputs:indirect_specular = 1
bool inputs:internal_reflections = 1
float inputs:metalness = 0
vector3f inputs:normal = (0, 0, 0)
color3f inputs:opacity = (1, 1, 1)
float inputs:sheen = 0
color3f inputs:sheen_color = (1, 1, 1)
float inputs:sheen_roughness = 0.3
float inputs:specular = 0
float inputs:specular_anisotropy = 0
color3f inputs:specular_color = (1, 1, 1)
float inputs:specular_IOR = 1.5
float inputs:specular_rotation = 0
float inputs:specular_roughness = 0.2
float inputs:subsurface = 0
float inputs:subsurface_anisotropy = 0
color3f inputs:subsurface_color = (1, 1, 1)
color3f inputs:subsurface_radius = (1, 1, 1)
float inputs:subsurface_scale = 1
token inputs:subsurface_type = "randomwalk"
vector3f inputs:tangent = (0, 0, 0)
float inputs:thin_film_IOR = 1.5
float inputs:thin_film_thickness = 0
bool inputs:thin_walled = 0
float inputs:transmission = 0
color3f inputs:transmission_color = (1, 1, 1)
float inputs:transmission_depth = 0
float inputs:transmission_dispersion = 0
float inputs:transmission_extra_roughness = 0
color3f inputs:transmission_scatter = (0, 0, 0)
float inputs:transmission_scatter_anisotropy = 0
bool inputs:transmit_aovs = 0
token outputs:shader
}
}
}

def Xform "lights"
{
def SphereLight "IES_light" (
prepend apiSchemas = ["ShapingAPI", "HoudiniViewportGuideAPI"]
)
{
float houdini:guidescale = 1
bool houdini:inviewermenu = 1
color3f inputs:color = (1, 1, 1)
float inputs:diffuse = 1
bool inputs:enableColorTemperature = 0
float inputs:exposure = 6.13
float inputs:intensity = 1
bool inputs:normalize = 0
float inputs:shaping:ies:angleScale = 0
asset inputs:shaping:ies:file = @./light.ies@
bool inputs:shaping:ies:normalize = 0
float inputs:specular = 1
float primvars:arnold:angle = 0 (
interpolation = "constant"
)
float primvars:arnold:roundness = 0 (
interpolation = "constant"
)
float primvars:arnold:soft_edge = 0 (
interpolation = "constant"
)
float primvars:arnold:spread = 1 (
interpolation = "constant"
)
float inputs:shaping:cone:angle = 30

bool treatAsPoint = 1
matrix4d xformOp:transform = ( (0.18805868587572247, 0, 0, 0), (0, 0.012662568311440343, -0.18763189680078854, 0), (0, 0.18763189680078854, 0.012662568311440343, 0), (0, 0.6011748909950256, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}

def Xform "cameras"
{
def Camera "camera1" (
prepend apiSchemas = ["HoudiniCameraPlateAPI", "HoudiniViewportGuideAPI"]
)
{
float2 clippingRange = (0.016529936, 16529.938)
float exposure = 0
float focalLength = 0.5
float focusDistance = 5
float fStop = 0
float horizontalAperture = 0.5
float horizontalApertureOffset = 0
asset houdini:backgroundimage = @@
asset houdini:foregroundimage = @@
float houdini:guidescale = 1
bool houdini:inviewermenu = 1
token projection = "perspective"
double shutter:close = 0.25
double shutter:open = -0.25
float verticalAperture = 0.28125
float verticalApertureOffset = 0
matrix4d xformOp:transform = ( (0.9999978067955211, -2.4712993064862036e-8, 0.0020943744046855316, 0), (0.0015622965079125652, 0.6660118639989476, -0.7459395124554461, 0), (-0.001394859766778299, 0.745941148491385, 0.6660104033373535, 0), (0.19100471581972733, 4.080508696713079, 3.6247999953273284, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}

Loading

0 comments on commit 9a7ef6c

Please sign in to comment.