Updating webgpu material colorNode

I got stuck trying to update a colorNode on a webgpu material. Colors weren’t changing. It requires the needsUpdate property like geometry attributes do.

Yup! when you redefine any material nodes an update is necessary.
like .MyNode = something
otherwise the shader doesn’t recompile.

But you can also use uniforms and pass your new color to the node instead, no recompilation needed in this case.

1 Like

It’s not well documented for webgpurender. I also tried the uniform function and didn’t update. I’m using the color tsl method.

Geometries needed modifying the original buffer, setting a range and then calling needsUpdate to properly update.

I’m trying to create an XR controller hover effect on intersections. To determine an intersection. Unfortunately the marker gets hidden under the mesh material with the colorNode change. Not sure what is going on there yet a renderOrder requirement ?