@alex thank you for this insight! This helped me get exactly what I needed for this prototype.
There was one piece I needed to add in order to render the vertex color. By default the point material has vertexColor= false
set by default, but I modified the value in the same call with
threeObj.material[0].vertexColors = true;`
For others who want to copy +
// typical loading of viewer
const worldTree = viewer.current?.getWorldTree();
const renderTree = worldTree?.getRenderTree();
const renderViews = renderTree?.getRenderableRenderViews(SpeckleType.Pointcloud);
const happyCloud= renderViews[0];
const threeObj = viewer.current
?.getRenderer()
.scene.getObjectByProperty('uuid', happyCloud.batchId);
// @ts-ignore
threeObj.material[0].vertexColors = true;
// @ts-ignore
const geometry = threeObj.geometry;
const pointCount = geometry.getAttribute('position').count;
const colors = new Float32Array(pointCount * 3);
for (let i = 0; i < pointCount * 3; i++) {
colors[i] = Math.random();
}
geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
geometry.attributes.color.needsUpdate = true;