Skip to content

Support for custom ShaderMaterials #747

@Charles-by

Description

@Charles-by

Is your feature request related to a problem? Please describe.

I am currently working with a pipeline where materials are authored in the Babylon.js material system and subsequently exported/generated as Three.js ShaderMaterial objects.

The primary frustration is that three-gpu-pathtracer is currently optimized for standard material types (e.g., MeshStandardMaterial, MeshPhysicalMaterial). Since ShaderMaterial is essentially a "black box" to the path tracer's kernel, it is impossible to path-trace these custom shaders or procedurally generated materials. This limits the engine's ability to handle complex, non-standard visual effects that go beyond the fixed PBR parameters.

Describe the solution you'd like

I would like to see a mechanism that allows the path tracer to "collect" or integrate custom shader logic into its evaluation loop. Specifically:

Custom Shader Integration: A way to parse or inject the logic within a ShaderMaterial so that the path tracer can evaluate its BSDF/sampling logic.

WebGPU Implementation: As the project migrates to WebGPU, I’m curious if there are plans to implement a more modular architecture—perhaps something akin to Blender Cycles' SVM (Shader Virtual Machine) or a node-based shader translation layer.

Extensibility: If a full SVM is too out of scope, perhaps a middle-ground solution where users can provide custom GLSL/WGSL snippets that the path tracer can invoke for material evaluation during the bounce calculation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions