Skip to content

MaterialXLoader: Avoid compiling unused BSDF lobes#33712

Merged
mrdoob merged 1 commit into
devfrom
materialx
Jun 3, 2026
Merged

MaterialXLoader: Avoid compiling unused BSDF lobes#33712
mrdoob merged 1 commit into
devfrom
materialx

Conversation

@mrdoob

@mrdoob mrdoob commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Description

The loader assigned float( 0 ) defaults to transmissionNode, sheenNode, clearcoatNode and anisotropyNode, which (via the use* getters) forced every material to compile those lobes — even ones that don't use them. Now they're only assigned when the MaterialX graph provides them.

Tested with webgpu_loader_materialx: ~14.3 ms → ~11.0 ms GPU/frame (~23%), no visual change.

Only assign the transmission, sheen, clearcoat and anisotropy node inputs when the MaterialX graph actually provides them. Assigning a `float( 0 )` default set the corresponding material node, which forced that lobe to compile into the shader even when unused.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrdoob mrdoob added this to the r185 milestone Jun 3, 2026
@mrdoob mrdoob merged commit c0ac898 into dev Jun 3, 2026
9 checks passed
@mrdoob mrdoob deleted the materialx branch June 3, 2026 12:39
@mrdoob

mrdoob commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

@bhouston FYI

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant