Skip to content

node material not working with shadowmap.enabled = true #25218

@patricklx

Description

@patricklx

Description

it will cause an error when setting a uniform value specific to MeshDistanceMaterial: Cannot read properties of undefined (reading 'value') at https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl/WebGLMaterials.js#L665

that is because the node builder overwrites it here: https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js#L96

which happens because of this: https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/webgl/nodes/WebGLNodes.js#L13

the fix is to just overwrite onBuild again for MeshDistanceMaterial.

THREE.MeshDistanceMaterial.prototype.onBuild = () => undefined;

or disabling shadowmap...

Reproduction steps

n/a

Code

n/a

Live example

n/a

Screenshots

No response

Version

145

Device

Desktop

Browser

Chrome

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions