allenai / allenai/ai2thor

Bug: Depth Image Values Are Incorrect Due to Wrong Multiplier

Ouverte
#1,301 0 commentaires 0 réactions 1 personne assignée Réclamée par @AlvaroHG Voir sur GitHub
Langage dominant
C#
Étoiles
1.8k
Forks
296
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## Summary

The depth values returned in `event.depth_frame` are wrong due to an incorrect understanding of Unity's `Linear01Depth()` function range.

`Linear01Depth()` returns values in range `[near/far, 1]`.

Reference: [Unity Forums Discussion](https://discussions.unity.com/t/linear01depth-is-it-working/446655/3)

## Current Implementation (INCORRECT)

```glsl
// unity/Assets/Scripts/ImageSynthesis/Shaders/Depth.shader (lines 56-57)
float multiplier = _ProjectionParams.z - _ProjectionParams.y; // far - near
float depth01 = Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, o.uv))) * multiplier;
```

- At near plane: depth = (near/far) × (far - near) = near - near^2 /far
- At far plane: depth = 1 × (far - near) = far - near

## Correct Implementation

```glsl
float depth = LinearEyeDepth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, o.uv)));
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.