Hi Everyone,
I stream encoded point clouds using Google Draco. Threejs version is 0.182.0. Draco has an option to skip vertex data dequantization at the decoding phase.
Dequantization is a process of converting integer coordinates using a formula like this:
vec3 decompressedPos = uMin + (position * uRange / uMaxQuantized);
where uMin, uRange, uMaxQuantized are constant parameters of quantization (per frame).
I thought my code could benefit from doing dequantization in the shader. So I defined this formula in the shader using ShaderMaterial, as shown above.
Geometry data is set like this:
mesh.geometry.setAttribute('position', new Uint32BufferAttribute(positions, 3, false))
Positions array is what comes from Draco in the uint32 format. I’m getting an error
[.WebGL-0x19ac0011f800] GL_INVALID_OPERATION: glDrawArrays: Vertex shader input type does not match the type of the bound vertex attribute.
I see there was a merge request regarding integer attributes Examples: Add integer attributes demo. by Mugen87 · Pull Request #19024 · mrdoob/three.js · GitHub but the attached application example does not demonstrate position integer attribute for this reason: “We can’t use ShaderMaterial in this case since it’s necessary to overwrite the default position attribute (which is vec3 but we would need ivec3).”
Surprisingly I do not get the error if I use Int16BufferAttribute, but the picture is corrupted because draco uses uint32 type.
Is my understanding correct that I don’t have options except maybe using webgl directly.