decentraland / decentraland/bevy-explorer

Highlight outline depth test issue: transparent meshes and occlusion

Open
#875 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
27
Forks
20
Avg merge
1d 30m
Merged PRs (30d)
78

Description

## Description

The highlight/outline effect has depth testing issues that cause incorrect rendering in two scenarios:

1. **Transparent mesh highlighting**: When a transparent mesh is highlighted, the outline appears on objects behind it instead of on the transparent mesh itself
2. **Occluded object highlighting**: When highlighting an object behind another object, the front (occluding) object appears to be highlighted instead

## Root Cause

The outline shader is likely using `depth != neighbor_depth` to detect edges, which triggers on depth discontinuities in both directions (front-to-back and back-to-front).

## Proposed Fix

Change the depth comparison to `depth > neighbor_depth` instead of `depth != neighbor_depth`. This will only draw outlines where the current pixel is farther than its neighbor, avoiding false positives from objects behind the highlighted mesh.

## Related

- Reported with screenshot showing transparent mesh outline issue

---
Requested by rob via Slack

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.