Skip to content

Volume Scattering Test Assets - #269

Open
MiiBond wants to merge 14 commits into
mainfrom
mbond/volume_scatter_anisotropy
Open

Volume Scattering Test Assets#269
MiiBond wants to merge 14 commits into
mainfrom
mbond/volume_scatter_anisotropy

Conversation

@MiiBond

@MiiBond MiiBond commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Here are a couple of possible conformance assets to test KHR_materials_volume_scatter.

The first one test varying values for anisotropic scattering:
screenshot_raytracer

The second one tests varying scattering colours and attenuation distances while attenuationColor is held constant. As multiscatterColorFactor tends to black, scattering is replaced by attenuation.
screenshot_raytrace

This one tests the scatterStrength parameter for thin-walled scattering.
scatterStrenthThin

And this one tests scatterStrength for volumetric scattering.
scatterStrength

@MiiBond MiiBond changed the title Volume Scatter Anisotropy asset Volume Scattering Test Assets Mar 10, 2026
@MiiBond

MiiBond commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

Here are renders in Babylon.js:

screenshot_rasterizer screenshot_rasterizer

@MiiBond

MiiBond commented Mar 25, 2026

Copy link
Copy Markdown
Contributor Author

I've updated the second asset now to vary multiscatterColorFactor from yellow to black on the X-axis and vary attenuationDistance on the Y-axis. When scattering is black, there will no longer be any scattering. However, the attenuationColor is constant for every material and so the scattering will be replaced by absorption as the multiscatterColorFactor tends to black.

I also added text labels for the axes.

@emackey

emackey commented Apr 27, 2026

Copy link
Copy Markdown
Member

During the PBR meeting we talked about the need for updated screenshots here.

Comment thread Models/ScatterAnisotropy/metadata.json Outdated
@MiiBond

MiiBond commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

I've updated the scattering assets to use the new KHR_materials_scatter extension as well as added a couple of new assets to test the new scatterStrengthFactor and scatterStrengthTexture parameters.

dfattal added a commit to DisplayXR/displayxr-demo-modelviewer that referenced this pull request Aug 12, 2026
…ttering)

Closes the subsurface gap flagged as our one hard limitation in the Khronos
/ Adobe OpenPBR thread, and makes us an early implementer of the draft
extension while Mike Bond's conformance assets are still in review
(KhronosGroup/glTF-Sample-Assets#269).

Parses scatterStrengthFactor (+ texture, ALPHA channel),
multiscatterColorFactor (+ texture, sRGB RGB) and scatterAnisotropy, adds
two material texture slots and two vec4s to the material SSBO, and shades
the lobe inside the existing transmission branch.

APPROXIMATION, and the spec allows it explicitly: "it is acceptable to
approximate volumetric mode using thin-walled mode behavior" for dense
subsurface materials. So volumetric mode runs the thin-walled BSDF -- a
Lambertian lobe of the multi-scatter albedo, split by anisotropy into a
forward half (the most-blurred scene copy standing in for a diffuse BTDF)
and a backward half (a diffuse reflection), per the spec's (1+g)/2 and
(1-g)/2 energy split. Full transport -- Kulla-Conty multi-to-single albedo
remap driving a Henyey-Greenstein walk -- has no place in a forward raster
pass. Dense is exactly the regime these assets occupy.

Measured on the conformance assets, whole-sphere means:

  ScatterAnisotropy, Volume row     before          after        reference
    g=-1                        ( 36, 40, 49)  (195,176, 68)  (199,162, 92)
    g= 0                        ( 30, 34, 41)  (192,174, 54)  (200,161, 81)
    g= 1                        ( 25, 28, 35)  (147,136, 42)  ( 75, 70, 57)

Before, the five spheres rendered IDENTICALLY -- the only material property
that varies across that sweep is scatterAnisotropy, so with the extension
ignored there was nothing to see. The sweep now varies monotonically in the
reference's direction.

THE DENSITY BUG, caught by eye on the 4x4 grid asset. Mixing on
scatterStrength alone discards the Beer-Lambert result, and since every
conformance asset sets scatterStrengthFactor = 1 that collapses to "always
fully scattered" -- rendering four IDENTICAL attenuationDistance rows.
The mix is now weighted by optical depth, 1 - exp(-thickness/attenuationDistance),
so a sparse volume stays a mostly-clear BTDF showing the backdrop and a
dense one fully diffuses. Sparse->dense luma now moves +57% against the
reference's +47%.

Known gaps, documented in the README rather than left to be discovered:
the density response SATURATES past optical depth ~1 where the reference
keeps grading, and the result is OVER-SATURATED, because real multiple
scattering desaturates as it redistributes energy between bounces and one
Lambertian bounce cannot. Neither is fixable without a real multi-bounce
term.

Also: SIM_DISPLAY_OUTPUT gains "2d". It previously had no value that could
select single-view -- "2d" fell through to the anaglyph default -- which
matters for measurement, since anaglyph combines the views per colour
channel and destroys exactly what is being measured.

Draft extension; subject to change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UQJUXzuNLSNtTFjjYVcZig
@emackey emackey added the PBR Physically Based Rendering label Aug 21, 2026
@mklefrancois

Copy link
Copy Markdown
Contributor

Here are the current results from vk_gltf_renderer

ScatterColorAndDensity ScatterAnisotropy ScatteringSkull ScatterStrength ScatterStrengthThinWalled

@emackey

emackey commented Aug 24, 2026

Copy link
Copy Markdown
Member

This branch needs a merge or rebase from main so that it can run the new CI.

Also we talked in the PBR TSG meeting about the need for the text labels on "Scatter Anisotropy" to avoid using +/- 1.

"version": 2,
"legal": [
{
"license": "CC-BY 4.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all four of the metadata.json files in this PR need to use dashes here, CC-BY-4.0 instead of the space. That appears to be the cause of the CI failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PBR Physically Based Rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants