Skip to content

Fix normals Float32 precision loss in JS#4

Open
robert-salata-hl wants to merge 1 commit intorbsheth:masterfrom
robert-salata-hl:fix-normals-float32-precision-loss
Open

Fix normals Float32 precision loss in JS#4
robert-salata-hl wants to merge 1 commit intorbsheth:masterfrom
robert-salata-hl:fix-normals-float32-precision-loss

Conversation

@robert-salata-hl
Copy link

For some specific geometries, o3dgc.js parser fails due to inaccurate normals computations. The m_normals array was defined as Float32Array, which does not provide precision necessary for computations performed inside ComputeNormals function, later resulting in error CubeToSphere[nin.m_z] is not a function. The issue can be observed on attached geometry mesh.o3dgc. The same geometry is parsed correctly by c++ parser.
mesh.zip

Changing Float32Array to Int32Array resolves the issue, and is aligned with c++ implementation - see Open3DGC/src/o3dgc_decode_lib/inc/o3dgcSC3DMCDecoder.inl file, ProcessNormals function. The n0 variable stores the same normal values as m_normals array in js, and is declared as Vec3<long>, not Vec3<float>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant