Recently, I bumped into something, which I don’t know how to identify: a bug or a feature.
I tried to modify vertexNode of Line2NodeMaterial, but it seems, that no matter what function you apply for that node, it will be ignored, and default functionality will be used.
Yeah, I’ve seen its source code
I simply followed that official example for fat line segments: three.js examples
And they instantiate that material without a specific import.
I was working on a CPU-based rope simulation using Verlet integration, but someone released a flashier WebGPU-based version before I had the chance to publish mine, effectively making it obsolete
Line2 extends InstancedMesh, so you’ll need to work with the instanced attributes rather than the standard vertex positions. Here’s a console.log output of a Line2 instance.
As you can see, the geometry uses instanced attributes. The instanceStart, and instanceEnd defines the positions of each segment.
To update them in your enigmatic (can’t wait for the wizardry you conjure up ) compute shader, I suppose you’ll have to wrap those attributes with a storage nodes.
Update: Not the most exciting update, but here goes…
After a closer look, Line2 uses an InstancedInterleavedBuffer, which, as far as I know, isn’t currently supported by the TSL implementation
Update2: Couldn’t end my post with a bad new…
It doesn’t have to be an InstancedInterleavedBuffer, you could copy the attributes content into a StorageInstancedBufferAttribute than use it with the storage node
then I expect, that I will see a black screen and/or a bunch of console errors. As I apply a function that returns nothing.
Instead, I’ve got a normally working scene with fat lines. And this is something enigmatic for me
Got a bit lost in translation there. I thought you were working on something enigmatic!
Not sure if it’s related, but I’ve noticed the TSL compiler tends to do some cleanup. It sometimes rewrites or removes functions, especially if they’re unused or return void.