Skip to content

camprojection emits non-finite data at zero camera depth #1694

Description

@dvasquezlopez

Specula found this at commit
88af9cc682d42e2e925daa0bae25f53277999f7b. The affected sensor.py is
byte-identical on current main commit
dcaa09431b84304d1de1e0c1200d981843104440.

camprojection guards camera-local depth below MJ_MINVAL by clamping it to
[-MJ_MINVAL, MJ_MINVAL]. Every value entering that branch is already inside
the interval, so the clamp changes nothing. Zero reaches the projection divide
unchanged, while other near-zero values retain too-small magnitudes.

Current sequence

T0: A camera-local point has zero or near-zero depth.
T1: The guard clamps that depth into an interval that already contains it.
T2: The unchanged depth reaches the projection divide.
T3: The projection becomes non-finite or ten times too large.

Proposed sequence

T0: A camera-local point has zero or near-zero depth.
T1: The guard sets its magnitude to MJ_MINVAL and preserves its sign.
T2: The projection divides by a bounded nonzero depth.
T3: The result remains finite and matches MuJoCo.

The exact public-path differential witness ran on CPU and CUDA. Ordinary depth
matches MuJoCo. At zero, MuJoCo returns finite
[-5.794112549695424e17, 240], while Warp returns [-inf, nan]. At
+/-1e-16, Warp has ten times MuJoCo's magnitude. The full suite and
multi-world batching were not run.

Replace the guarded denominator explicitly and add CPU/CUDA parity tests for
negative near-zero, zero, positive near-zero, and ordinary depth.

@thowell was detected as the most likely owner from current-source blame.
Please feel free to assign this to someone else if another owner is closer to
the code.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions