Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - add standard material depth bias to pipeline #7847

Closed
wants to merge 2 commits into from

Conversation

robtfm
Copy link
Contributor

@robtfm robtfm commented Feb 28, 2023

Objective

the current depth bias only adjusts ordering, so it doesn't work for opaque meshes vs alpha-blend meshes, and it doesn't help when two meshes are infinitesimally offset from one another.

Solution

pass the material's depth bias into the pipeline depth stencil constant field.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A simple quality-of-life change that makes Bevy easier to use C-Bug An unexpected or incorrect behavior and removed C-Usability A simple quality-of-life change that makes Bevy easier to use labels Feb 28, 2023
@@ -507,6 +508,7 @@ pub struct MaterialProperties {
pub alpha_mode: AlphaMode,
/// Add a bias to the view depth of the mesh which can be used to force a specific render order
/// for meshes with equal depth, to avoid z-fighting.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// for meshes with equal depth, to avoid z-fighting.
/// for meshes with similar depth, to avoid z-fighting.

nit: change this line to match the change in documentation for fn depth_bias(&self)

Copy link
Contributor

@superdump superdump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

bors bot pushed a commit that referenced this pull request Mar 4, 2023
# Objective

the current depth bias only adjusts ordering, so it doesn't work for opaque meshes vs alpha-blend meshes, and it doesn't help when two meshes are infinitesimally offset from one another.

## Solution

pass the material's depth bias into the pipeline depth stencil `constant` field.
@bors bors bot changed the title add standard material depth bias to pipeline [Merged by Bors] - add standard material depth bias to pipeline Mar 4, 2023
@bors bors bot closed this Mar 4, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
# Objective

the current depth bias only adjusts ordering, so it doesn't work for opaque meshes vs alpha-blend meshes, and it doesn't help when two meshes are infinitesimally offset from one another.

## Solution

pass the material's depth bias into the pipeline depth stencil `constant` field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants