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

Enabling transparency is cumbersome #64

Closed
cart opened this issue Jul 20, 2020 · 5 comments
Closed

Enabling transparency is cumbersome #64

cart opened this issue Jul 20, 2020 · 5 comments
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible

Comments

@cart
Copy link
Member

cart commented Jul 20, 2020

Currently when using common materials like ColorMaterial and StandardMaterial, users need to remember to enable draw.is_transparent. This will be a common "foot gun" and it should really happen automatically if the color has an alpha component.

// currently this is required
world.spawn(NodeComponents {
    material: materials.add(Color::rgba(1.0, 0.9, 0.9, 0.4).into()),
    draw: Draw {
        is_transparent: true,
        ..Default::default()
    },
    ..Default::default()
})

// ideally the `0.4` alpha value results in alpha transparency
world.spawn(NodeComponents {
    material: materials.add(Color::rgba(1.0, 0.9, 0.9, 0.4).into()),
    ..Default::default()
})
@karroffel karroffel added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen labels Aug 12, 2020
@entropylost
Copy link
Contributor

Yeah I just shot myself in the foot with this.

@mockersf
Copy link
Member

would it be a good fix to have the default being transparent?

@cart
Copy link
Member Author

cart commented Dec 14, 2020

Thats a good idea. It comes at the cost of "early fragment discarding" by default for obscured opaque object fragments, but in 2d fully opaque is less common.

At the very least it seems like a reasonable default for NodeBundle while we sort out more complicated solutions

@blaind
Copy link
Contributor

blaind commented Jul 23, 2021

For anyone wondering, this also applies to textures with alpha channel.

The Draw component seems to have changed, and current iteration (comment in code that might be moved to materials eventually) works with modifying a Visible -component in a bundle (e.g. PbrBundle):

visible: Visible {
    is_transparent: true,
    ..Default::default()
},

@IceSentry
Copy link
Contributor

Now that #4658 is merged I believe this can be closed.

tychedelia pushed a commit to tychedelia/bevy that referenced this issue Nov 23, 2024
the `undecorate_regex` captures part of the ansi color codes and eats
them in error reports.

updated the regex to exclude ansi codes from matched names.

fixes bevyengine#64
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-Feature A new feature, making something new possible
Projects
None yet
Development

No branches or pull requests

6 participants