Skip to content

Preserve small-angle geometry, dtype and gradients in direction alignment - #3795

Open
Afloat16 wants to merge 1 commit into
nerfstudio-project:mainfrom
Afloat16:fix/direction-alignment-geometry
Open

Afloat16 wants to merge 1 commit into
nerfstudio-project:mainfrom
Afloat16:fix/direction-alignment-geometry

Conversation

@Afloat16

@Afloat16 Afloat16 commented Oct 2, 2026 •

Copy link
Copy Markdown

rotation_matrix_between loses small camera-orientation changes when acos(dot(a, b)) rounds to zero, and loses near-half-turn offsets when the dot product rounds to -1. For float32 a=(1,0,0), b=normalize((1,1e-5,0)), it returns identity even though the cross product retains the rotation. Its tensor constructors also force float32 CPU output for float64 inputs and detach the skew matrix from autograd.

Use the cross-product form of Rodrigues' formula with denominator 1 + cos(theta) on the nonnegative-cosine hemisphere, where that denominator is bounded below by one. This retains small rotations and the correct derivative at aligned vectors. On the opposite hemisphere, use atan2(||a x b||, a dot b) and a normalized axis; exact antiparallel inputs use a deterministic perpendicular axis and the proper half-turn matrix. Build the identity and skew matrix from the input tensor so dtype, device and gradients are preserved.

Validation: Windows CPU, Python 3.12.10, Torch 2.7.1+cpu and Open3D 0.19.0; project-pinned pytest 7.1.2 and xdist 2.5.0.

Full repository Ruff 0.12.2 lint/format, Pyright 1.1.331 (203 files, 0 errors, 16 identical baseline warnings), native license checks, notebook metadata checks, and the Sphinx 5.2.1 warnings-as-errors build all pass.

The complete pytest suite with the repository's original configuration reports 106 passed / 2 failed, compared with 81 passed / 2 failed on upstream 50e0e3c. All 25 added regression cases pass. Both failures are identical pre-existing Windows failures in test_deserialize_config1 and test_deserialize_config2: their YAML fixtures instantiate pathlib.PosixPath. No tests were skipped, deselected, or modified.

The component tools were invoked directly because ns-dev-test uses Linux shell command strings. This does not establish a fully green ns-dev-test run; GPU behavior remains untested.

Remote CI update (October 3): the documentation check succeeds, but the build run stops at Pyright after resolving Open3D 0.20.0. Its 19 diagnostics occur in unchanged data parsers, processing utilities, and exporters. The same diagnostics occur in the build for independent PR #3790, whose single COLMAP parsing change is based on the same upstream commit. This comparison supports a dependency compatibility problem; the remote pytest step was skipped, so it does not establish passing remote tests.

The Docker run fails while building the pinned tiny-cuda-nn dependency with ModuleNotFoundError: No module named 'pkg_resources', before installing Nerfstudio source. PR #3790's Docker run shows the same failure. Both CI gates remain failed.

Rotation-axis choice at exactly antiparallel inputs remains nonunique.

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