Skip to content

fix: UI depth bias does not account for facing direction#2791

Merged
Eideren merged 1 commit into
stride3d:masterfrom
Eideren:ui_clipping
May 24, 2025
Merged

fix: UI depth bias does not account for facing direction#2791
Eideren merged 1 commit into
stride3d:masterfrom
Eideren:ui_clipping

Conversation

@Eideren
Copy link
Copy Markdown
Collaborator

@Eideren Eideren commented May 17, 2025

PR Details

UI elements have individual depth bias applied to them to ensure they are drawn in the correct order. This works fine when you expect the UI to always face the camera, like is the case for billboards and fullscreen UI, but worldspace UI do not always face the camera, this PR reverses the bias if the UI is facing away from the camera.

Here, the orange line is a UI element from a world space UI facing away from the camera. The black cube is in front of the UI - the element should be completely occluded by the cube, but the depth bias pulled the UI towards the camera enough as to make it clip in front of it
image
With this PR's change, the depth bias is reversed, when the element is facing away from the camera, pushing it away from the camera resolving this issue;
image

Related Issue

None reported.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@Eideren Eideren merged commit 101636b into stride3d:master May 24, 2025
2 checks passed
@Eideren Eideren deleted the ui_clipping branch May 24, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant