Skip to content

TSL&NodeMaterial: Unexpected result with custom material. #31947

@Jenychen1996

Description

@Jenychen1996

Description

Extending from NodeMaterial, rewrite the ColorNode and PositionNode materials, and initialize multiple material objects in the same scene. Only the Node of the first one is not null, while the rest are null.

When I use a custom input parameter, such as speed, in a ColorNode or PositionNode, the last input speed data will be used globally.

I encountered this issue while using Line2NodeMaterial in webgpu_lines_fat_raycasting.html.

Reproduction steps

  1. Extend from NodeMaterial to implement a custom Material, such as Line2NodeMaterial.
  2. Modify ColorNode, PositionNode, etc.
  3. In the same scene, initialize multiple custom Materials.
  4. When executing the code in the console, you will find that it is null.
materials.forEach(material => {
    console.log(material.colorNode)
})

Code

like Line2NodeMaterial

Live example

NodeMaterial

Screenshots

No response

Version

r178

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions