Skip to content

Commit 02e2bc3

Browse files
authored
Fix the subsurface_bssrdf parameters (#1823)
Fix the subsurface_bssrdf parameters to use effective color and radius instead of single scattering parameters Signed-off-by: Chris Kulla <ckulla@gmail.com>
1 parent b284a8b commit 02e2bc3

File tree

4 files changed

+16
-33
lines changed

4 files changed

+16
-33
lines changed

src/doc/languagespec.tex

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5049,27 +5049,19 @@ \subsection{Surface BSDF closures}
50495049

50505050
\apiitem{albedo}
50515051
\vspace{12pt}
5052-
Single-scattering albedo of the medium.
5053-
\apiend
5054-
\vspace{-16pt}
5055-
5056-
\apiitem{transmission_depth}
5057-
\vspace{12pt}
5058-
Distance travelled inside the medium by white light before its color becomes
5059-
transmission_color by Beer's law. Given in scene length units, range
5060-
[0,infinity). Together with transmission_color this determines the
5061-
extinction coefficient of the medium.
5052+
Effective albedo of the medium (after multiple scattering). The renderer is expected to
5053+
invert this color to derive the appropriate single-scattering albedo that will produce
5054+
this color for the average random walk.
50625055
\apiend
50635056
\vspace{-16pt}
50645057

5065-
\apiitem{transmission_color}
5058+
\apiitem{radius}
50665059
\vspace{12pt}
5067-
Desired color resulting from white light transmitted a distance of
5068-
'transmission_depth' through the medium. Together with transmission_depth
5069-
this determines the extinction coefficient of the medium.
5060+
Average distance travelled inside the medium per color channel. This is typically taken
5061+
to be the mean-free path of the volume.
50705062
\apiend
50715063
\vspace{-16pt}
5072-
5064+
50735065
\apiitem{anisotropy}
50745066
\vspace{12pt}
50755067
Scattering anisotropy [-1,1]. Negative values give backwards scattering,

src/doc/stdlib.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,14 +1506,11 @@ properties of the physically-based shading nodes of MaterialX v1.38
15061506
: Normal vector of the surface point being shaded.
15071507

15081508
`albedo`
1509-
: Single-scattering albedo of the medium.
1510-
1511-
`transmission_depth`
1512-
: Distance travelled inside the medium by white light before its color becomes transmission_color by Beer's law. Given in scene length units, range [0,infinity). Together with transmission_color this determines the extinction coefficient of the medium.
1513-
1514-
`transmission_color`
1515-
: Desired color resulting from white light transmitted a distance of 'transmission_depth' through the medium. Together with transmission_depth this determines the extinction coefficient of the medium.
1509+
: Effective albedo of the medium (after multiple scattering). The renderer is expected to invert this color to derive the appropriate single-scattering albedo that will produce this color for the average random walk.
15161510

1511+
`radius`
1512+
: Average distance travelled inside the medium per color channel. This is typically taken to be the mean-free path of the volume.
1513+
15171514
`anisotropy`
15181515
: Scattering anisotropy [-1,1]. Negative values give backwards scattering, positive values give forward scattering, and 0.0 gives uniform scattering.
15191516

src/shaders/stdosl.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -587,17 +587,13 @@ closure color transparent_bsdf() BUILTIN;
587587
// Constructs a BSSRDF for subsurface scattering within a homogeneous medium.
588588
//
589589
// \param N Normal vector of the surface point being shaded.
590-
// \param albedo Single-scattering albedo of the medium.
591-
// \param transmission_depth Distance travelled inside the medium by white light before its color becomes transmission_color by Beer's law.
592-
// Given in scene length units, range [0,infinity). Together with transmission_color this determines the extinction
593-
// coefficient of the medium.
594-
// \param transmission_color Desired color resulting from white light transmitted a distance of 'transmission_depth' through the medium.
595-
// Together with transmission_depth this determines the extinction coefficient of the medium.
590+
// \param albedo Effective albedo of the medium (after multiple scattering). The renderer is expected to invert this color to derive the appropriate single-scattering albedo that will produce this color for the average random walk.
591+
// \param radius Average distance travelled inside the medium per color channel. This is typically taken to be the mean-free path of the volume.
596592
// \param anisotropy Scattering anisotropy [-1,1]. Negative values give backwards scattering, positive values give forward scattering,
597593
// and 0.0 gives uniform scattering.
598594
// \param label Optional string parameter to name this component. For use in AOVs / LPEs.
599595
//
600-
closure color subsurface_bssrdf(normal N, color albedo, float transmission_depth, color transmission_color, float anisotropy) BUILTIN;
596+
closure color subsurface_bssrdf(normal N, color albedo, color radius, float anisotropy) BUILTIN;
601597

602598
// Constructs a microfacet BSDF for the back-scattering properties of cloth-like materials.
603599
// This closure may be vertically layered over a base BSDF, where energy that is not reflected

src/testrender/shading.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ struct MxTranslucentParams {
196196
struct MxSubsurfaceParams {
197197
Vec3 N;
198198
Color3 albedo;
199-
float transmission_depth;
200-
Color3 transmission_color;
199+
Color3 radius;
201200
float anisotropy;
202201
// optional
203202
ustringhash label;
@@ -389,8 +388,7 @@ register_closures(OSL::ShadingSystem* shadingsys)
389388
MX_SUBSURFACE_ID,
390389
{ CLOSURE_VECTOR_PARAM(MxSubsurfaceParams, N),
391390
CLOSURE_COLOR_PARAM(MxSubsurfaceParams, albedo),
392-
CLOSURE_FLOAT_PARAM(MxSubsurfaceParams, transmission_depth),
393-
CLOSURE_COLOR_PARAM(MxSubsurfaceParams, transmission_color),
391+
CLOSURE_COLOR_PARAM(MxSubsurfaceParams, radius),
394392
CLOSURE_FLOAT_PARAM(MxSubsurfaceParams, anisotropy),
395393
CLOSURE_STRING_KEYPARAM(MxSubsurfaceParams, label, "label"),
396394
CLOSURE_FINISH_PARAM(MxSubsurfaceParams) } },

0 commit comments

Comments
 (0)