allenai / allenai/ai2thor

Bug: Depth Image Values Are Incorrect Due to Wrong Multiplier

未关闭
#1,301 0 条评论 0 个 reaction 已指派 1 人 已被 @AlvaroHG 认领 在 GitHub 查看
主要语言
C#
星标
1.8k
派生
297
PR 合并指标
30 天内没有已合并 PR

描述

## 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)));
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。