Skip to content

Build geometric normal prediction only over octahedron transforms - #1239

Open
Filyus wants to merge 1 commit into
google:mainfrom
Filyus:geometric-normal-only-over-octahedron
Open

Filyus wants to merge 1 commit into
google:mainfrom
Filyus:geometric-normal-only-over-octahedron

Conversation

@Filyus

@Filyus Filyus commented Oct 4, 2026

Copy link
Copy Markdown

Integer normals that are not quantized keep the wrap transform, and below speed 4 the encoder selects MESH_PREDICTION_GEOMETRIC_NORMAL for them. MeshPredictionSchemeEncoderFactory builds that scheme over whatever transform it is given, and the scheme asks the wrap transform for quantization bits, which it answers with a stub returning -1 behind DRACO_DCHECK(false). Debug builds assert. Release builds predict from an uninitialized octahedron toolbox and write a stream that decodes to different normals, with every step reporting success.

The decoder factory builds geometric normal prediction only for the normal octahedron transforms. The encoder factory now does the same and returns nullptr otherwise, so the caller falls back to delta coding as it does for any scheme that cannot be built. Quantized normals are unaffected: draco_encoder writes the same bytes as before for cube_att.obj, test_nm.obj, sphere.obj, bun_zipper.ply and a point cloud with normals at -cl 0, 1, 2, 3, 4, 7 and 10.

TestIntegerNormalsAtSpeedZeroRoundTrip encodes a 5x5 grid with int32 normals in [-3, 3] at speeds 0/0 and compares the decoded normals with the input. Before this change they come back as unrelated values.

Integer normals that are not quantized keep the wrap transform, and
below speed 4 the encoder selects MESH_PREDICTION_GEOMETRIC_NORMAL for
them. MeshPredictionSchemeEncoderFactory builds that scheme over
whatever transform it is given, and the scheme asks the wrap transform
for quantization bits, which it answers with a stub returning -1 behind
DRACO_DCHECK(false). Debug builds assert. Release builds predict from an
uninitialized octahedron toolbox and write a stream that decodes to
different normals, with every step reporting success.

The decoder factory builds geometric normal prediction only for the
normal octahedron transforms. The encoder factory now does the same and
returns nullptr otherwise, so the caller falls back to delta coding as
it does for any scheme that cannot be built. Quantized normals are
unaffected: draco_encoder writes the same bytes as before for
cube_att.obj, test_nm.obj, sphere.obj, bun_zipper.ply and a point cloud
with normals at -cl 0, 1, 2, 3, 4, 7 and 10.

TestIntegerNormalsAtSpeedZeroRoundTrip encodes a 5x5 grid with int32
normals in [-3, 3] at speeds 0/0 and compares the decoded normals with
the input. Before this change they come back as unrelated values.

This branch has not been deployed

No deployments
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