it is based on antimatter15 and has been reworked to integrate with threejs.
each splat is a regular object3d and behaves as such
it shares data when you use the same splat multiple times
you can have multiple splats with semi-correct depth ordering via alphatest
it also supports alphahash for realistic ordering
i’ve made the code from a vanilla perspective, it’s a SplatLoader and a ShaderMaterial. you can already pick it up from drei source if you don’t use react+three or wait until this is available in vanilla-drei (today or tomorrow).
@Fennec thanks! to do that was a major struggle, making them behave as regular Object3D’s i mean. and now that they are it can be integrated into anything.
For those who might be interested, here is a link to my online SPLAT Viewer using vanilla-drei splat.
It is currently set for loading a single splat either locally or remotely.
The code is available here so you can see how to import it.
It also supports loading of the Luma AI links via its URL option. This will show the foreground only but if you want the background as well then download the html file and modify it yourself.
@drcmda
Thank you very much for this implementation. I’m trying to change the color at some indices when a user does something. How should I update the state? It seems like doing this screws up the rendering, and the splat is rendered as a point cloud:
const { covAndColorData, covAndColorTexture, gl, bufferTextureWidth } = this.splat;
const covAndColorData_uint8 = new Uint8Array(covAndColorData.buffer);
const context = gl.getContext();
const covAndColorTextureProperties = gl.properties.get(covAndColorTexture);
context.bindTexture(context.TEXTURE_2D, covAndColorTextureProperties.__webglTexture);
for (const i of inds) {
covAndColorData_uint8[i * 16 + 12] = this.selectionColor[0] * 255;
covAndColorData_uint8[i * 16 + 13] = this.selectionColor[1] * 255;
covAndColorData_uint8[i * 16 + 14] = this.selectionColor[2] * 255;
// Calculate the texture coordinates and dimensions of the region to update
const xoffset = i % bufferTextureWidth;
const yoffset = Math.floor(i / bufferTextureWidth);
const width = 1;
const height = 1;
context.texSubImage2D(
context.TEXTURE_2D,
0,
xoffset,
yoffset,
width,
height,
context.RGBA_INTEGER,
context.UNSIGNED_INT,
covAndColorData,
i * 4,
);
}
gl.resetState();
covAndColorTexture.needsUpdate = true;