Skip to content

Cannot override vertexNode of instanced mesh with morphTargets (TSL) #31131

@Bug-Reaper

Description

@Bug-Reaper

Description

I've had mixed luck in the past doing a custom vertexNode for instanced mesh like so:

// insty is a shared instanced buffer attribute
const vOverride= Fn(()=>{
return mul(
      cameraProjectionMatrix, // Takes the shape of the camera into account?
      modelViewMatrix, // Takes the position of the camera into account
      insty.element(instanceIndex),
      vec4(mul(positionGeometry.xyz,noiseMix), 1)
    );
}

However when I go to try this with my instanced-mesh with morph-targets I get no errors but also nothing draws on screen.

Reproduction steps

Spent a day trying to figure this out and AFAIK it's impossible to do a VertexNode that properly replicates the original behavior of an instancedMesh material's vertexNode so it can be modified?

Ideally I'd also be able to use the InstanceMatrix and other built-in attributes instead of rolling my own?

Code

Best attempt so far:

// insty is a shared instanced buffer attribute
const vOverride= Fn(()=>{
return mul(
      cameraProjectionMatrix, // Takes the shape of the camera into account?
      modelViewMatrix, // Takes the position of the camera into account
      insty.element(instanceIndex),
      vec4(mul(positionGeometry.xyz,noiseMix), 1)
    );
}

Live example

Will try and setup fiddle if I have time.
EDIT: https://jsfiddle.net/q28ast3k/9/

Screenshots

No response

Version

r176

Device

Desktop, Mobile

Browser

Firefox, Safari, Chrome

OS

MacOS, Windows, Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSLThree.js Shading Language

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions