Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/Materials/TestSuite/_options.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<input name="extraLibraryPaths" type="string" value="" />

<!-- List of document paths for render tests -->
<input name="renderTestPaths" type="string" value="resources/Materials/Examples/StandardSurface,resources/Materials/TestSuite/stdlib/convolution,resources/Materials/TestSuite/stdlib/color_management,resources/Materials/TestSuite/stdlib/procedural,resources/Materials/TestSuite/pbrlib/surfaceshader,resources/Materials/TestSuite/nprlib" />
<input name="renderTestPaths" type="string" value="resources/Materials/Examples/StandardSurface,resources/Materials/TestSuite/stdlib/convolution,resources/Materials/TestSuite/stdlib/color_management,resources/Materials/TestSuite/stdlib/procedural,resources/Materials/TestSuite/pbrlib,resources/Materials/TestSuite/nprlib" />

<!-- Enable reference quality rendering.
This option enables higher sample counts and supersampling in render tests,
Expand Down
17 changes: 11 additions & 6 deletions source/MaterialXGenMdl/mdl/materialx/pbrlib_1_6.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,16 @@ export material mx_subsurface_bsdf(
color mxp_color = color(0.18),
color mxp_radius = color(1.0),
float mxp_anisotropy = 0.0,
float3 mxp_normal = state::normal() [[ anno::unused() ]]
float3 mxp_normal = state::normal()
) [[
anno::usage( "materialx:bsdf")
]]
= let {
// https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf
// Phase function eccentricity 'g' has been omitted here since we pass that directly
// to anisotropic_vdf(directional_bias: g).
color C = math::saturate(mxp_weight) * mxp_color;
float w = math::saturate(mxp_weight);
color C = mxp_color;
color albedo = color(4.09712) +
(4.20863f * C) -
math::sqrt(
Expand All @@ -364,7 +365,7 @@ export material mx_subsurface_bsdf(
color white = color(1.0, 1.0, 1.0);
color alpha = (white - albedo_sq) / (white - mxp_anisotropy * albedo_sq);

color radius_inv = white / math::max(color(0.001), mxp_radius);
color radius_inv = white / math::max(0.00000001, mxp_radius);

color sigma_s = alpha * radius_inv;
color sigma_a = radius_inv - sigma_s;
Expand All @@ -374,12 +375,16 @@ export material mx_subsurface_bsdf(
scattering: df::anisotropic_vdf (
directional_bias: mxp_anisotropy
),
scattering_coefficient: sigma_s,
absorption_coefficient: sigma_a
scattering_coefficient: w * sigma_s,
absorption_coefficient: w * sigma_a
),

surface: material_surface(
scattering: df::diffuse_transmission_bsdf(tint: white)
scattering: df::weighted_layer(
weight: w,
layer: df::diffuse_transmission_bsdf(tint: white),
normal: mxp_normal
)
)
);

Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXTest/MaterialXGenMdl/GenMdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void MdlShaderGeneratorTester::compileSource(const std::vector<mx::FilePath>& so
if (renderArgs.empty())
{
// Assume MDL example DXR is being used and set reasonable arguments automatically
renderCommand += " --nogui --res 512 512 --iterations 1024 --max_path_length 3 --noaux --no_firefly_clamp";
renderCommand += " --nogui --res 512 512 --iterations 1024 --max_path_length 4 --noaux --no_firefly_clamp";
renderCommand += " --background 0.073239 0.073239 0.083535";
}
else
Expand Down