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] - use alpha mask even when unlit #6047

Closed
wants to merge 2 commits into from

Conversation

IceSentry
Copy link
Contributor

@IceSentry IceSentry commented Sep 21, 2022

Objective

Solution

  • Extract the alpha discard to a separate function and use it when unlit is true

Notes

I tried calling alpha_discard() before the if in pbr.wgsl, but I had errors related to having a discard at the beginning before doing the texture sampling. I'm not sure if there's a way to fix that instead of having the function being called in 2 places.

@IceSentry IceSentry added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior labels Sep 21, 2022
@robtfm
Copy link
Contributor

robtfm commented Sep 23, 2022

this also causes the alpha channel to be forced to 1.0 for unlit+opaque so it's not a raw passthrough of the input value any more. i think that's fine though, i can't see a good reason to use opaque with an alpha < 1.0.

for unlit+blend the behaviour will be unchanged, and for unlit+mask the alpha will be 0 or 1 as expected.

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 Sep 28, 2022
# Objective

- Alpha mask was previously ignored when using an unlit material. 
- Fixes #4479

## Solution

- Extract the alpha discard to a separate function and use it when unlit is true

## Notes
I tried calling `alpha_discard()` before the `if` in pbr.wgsl, but I had errors related to having a `discard` at the beginning before doing the texture sampling. I'm not sure if there's a way to fix that instead of having the function being called in 2 places.
@bors
Copy link
Contributor

bors bot commented Sep 28, 2022

Build failed:

@mockersf
Copy link
Member

mockersf commented Sep 28, 2022

@IceSentry this PR needs to be updated with latest main and the spawn bundle changes

@IceSentry
Copy link
Contributor Author

Done.

@mockersf
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Sep 28, 2022
# Objective

- Alpha mask was previously ignored when using an unlit material. 
- Fixes #4479

## Solution

- Extract the alpha discard to a separate function and use it when unlit is true

## Notes
I tried calling `alpha_discard()` before the `if` in pbr.wgsl, but I had errors related to having a `discard` at the beginning before doing the texture sampling. I'm not sure if there's a way to fix that instead of having the function being called in 2 places.
@bors bors bot changed the title use alpha mask even when unlit [Merged by Bors] - use alpha mask even when unlit Sep 28, 2022
@bors bors bot closed this Sep 28, 2022
@IceSentry IceSentry deleted the alpha-unlit branch September 28, 2022 16:40
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 19, 2022
# Objective

- Alpha mask was previously ignored when using an unlit material. 
- Fixes bevyengine#4479

## Solution

- Extract the alpha discard to a separate function and use it when unlit is true

## Notes
I tried calling `alpha_discard()` before the `if` in pbr.wgsl, but I had errors related to having a `discard` at the beginning before doing the texture sampling. I'm not sure if there's a way to fix that instead of having the function being called in 2 places.
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

- Alpha mask was previously ignored when using an unlit material. 
- Fixes bevyengine#4479

## Solution

- Extract the alpha discard to a separate function and use it when unlit is true

## Notes
I tried calling `alpha_discard()` before the `if` in pbr.wgsl, but I had errors related to having a `discard` at the beginning before doing the texture sampling. I'm not sure if there's a way to fix that instead of having the function being called in 2 places.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Alpha mask was previously ignored when using an unlit material. 
- Fixes bevyengine#4479

## Solution

- Extract the alpha discard to a separate function and use it when unlit is true

## Notes
I tried calling `alpha_discard()` before the `if` in pbr.wgsl, but I had errors related to having a `discard` at the beginning before doing the texture sampling. I'm not sure if there's a way to fix that instead of having the function being called in 2 places.
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.

Unlit materials don't seem to respect AlphaMode::Mask
4 participants