Ah that’s beautiful! A really nice effect here.
Now someday we will have to get this working with THREE.SkinnedMesh…
Haha, I was just about to ask… Does this work on a SkinnedMesh?
Maybe I’m over-simplifying this, but isn’t there a way to read back the vertex attributes from the GPU to get the needed vertex transforms? The only (big) downside is that the surface sampler is always one frame behind…which for some people is very confusing
Suggested an option in Reuse model animation with samples of its geometry - #4 by donmccurdy, there might be other options. Involves sampling the skinIndex/skinWeights attributes with each sample and would require a few MeshSurfaceSampler changes.
Beautiful, about skinned mesh:
The main difference is that I did CPU-side skinning before sampling the mesh surface there. That process is pretty slow though, CPU-side skinning that is.
btw, why would it be not possible to inject mesh skinning chunks/uniforms into points via onBeforeCompile
If I’m not mistaken, vertex transformations for skinned meshes are done solely on the GPU. So unless you’d do some sort of pre-pass to fetch the data back from VBO, you’ll always be a frame behind. Calculating this on the CPU is quite resource intensive, which is probably why this isn’t built-in yet.
SkinnedMesh has a
.boneTransform method that can do the skinning transform for a particular vertex. Doing it for every vertex on every frame would be expensive. But you can use the method for raycasting or other purposes.
Lets start with this simple hack and see if we can get the colors in…
well, we can, except that without lights it kinda looks bad
now without parent mesh you can tolerate the difference
also for some reason we cant just do mesh.material.visible = false; most probably three.js is not entirely convinced our points need skinning actually I was just being stupid - https://jsfiddle.net/dbqtro30/
ok I got distracted and by now Im out of steam to throw remeshing code in for buffer geometry that has skinIndex/Weight, but maybe @donmccurdy can step in lol