-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Labels
TSLThree.js Shading LanguageThree.js Shading Language
Milestone
Description
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
Bug-Reaper
Metadata
Metadata
Assignees
Labels
TSLThree.js Shading LanguageThree.js Shading Language