-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
white outlines around sprite #5266
Comments
Like the result of the new anti-aliasing changes. @superdump @aevyrie do either of you recall exactly which PR this was? |
Yes I think so, I tried to change the Mssa samples, but didn't seem to fix it |
Try changing image filtering to nearest |
I added this
but it doesn't seem to be fixing it |
Just to confirm, did you try removing/commenting out the |
ClearColor as a component on an entity with a SpriteBundle looks odd to me |
|
This is a good example in the wild of why #5007 is helpful :) |
Yes |
Yes, I was just testing, I removed it later, sorry for not clarifying |
this solved the white outlines issue thanks! however the image is looking a bit pixelated while moving if that makes sense... ezgif.com-gif-maker.1.mp4 |
@alice-i-cecile I don't think this should be closed. @aevyrie Do you have any idea what is causing this, and how it should be fixed? (Asking since you suggested using nearest.) This really should be fixed before |
I agree, this shouldn't be closed yet. @BKSalman can you share the sprite and an small example that shows the original issue? I'd like to investigate it and it will be quicker if I can reproduce the problem locally. |
I've seen this before and I think it's a bug with how alpha is sampled and blended. I would've thought this would be handled automagically seeing as we don't define the behavior of samplers (?). @superdump pretty sure I've seen this when linearly sampling an image with transparency so I don't think it's unique to this particular image. The border from none to some alpha turns white instead of the alpha component being used. We should make a test image that has an alpha gradient. |
I grabbed the khronos gltf alpha blend test texture from here: https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/AlphaBlendModeTest/glTF/AlphaBlendLabels.png It has a blue and yellow striped region which fades from alpha = 1 at the bottom to alpha = 0 at the top. That region has an opaque black border around it. It exhibits a similar issue: From that I guess that the alpha value of the opaque pixel immediately adjacent to the transparent pixels is being bilinearly-interpolated between close to 0 and 1, so significantly increasing the alpha, and blending the saturated stripe colours with black to create the outline. I inspected this in an Xcode GPU frame capture. The following three images show the pixel to the left that is sampled from four surrounding transparent pixels, then from a mix of 2 transparent pixels and 2 opaque pixels, resulting in the bad-looking coloured pixels, then four opaque pixels: I'm not sure how to solve this aside from not having opaque pixels next to transparent pixels of a contrasting colour. Maybe someone has a good idea or maybe I'll come up with one. I'll let it stew for a bit. |
This looks like the same issue, with solutions: https://stackoverflow.com/questions/45742828/opengl-blending-creates-white-border-around-textures |
sorry for not replying quickly ( that's the least I could do to help this awesome engine! ) you can check all of the source code in this repo, it's a pretty small and simple project should be really easy to navigate through + it has the images used |
@CptPotato I'm inclined to agree this is an asset issue. The linear filter is behaving as expected in this case, interpolating between white transparent and black opaque. |
For reference, Godot has an asset import option that addresses this: A similar feature might be useful once bevy has it's own asset pipeline. |
I also have this problem but it seems that the |
It is in bevy main, not yet released to crates.io. You can see it in the dev docs here: https://dev-docs.bevyengine.org/bevy/render/texture/struct.ImageSettings.html |
I have the same problem when I working with bevy 0.8.0, and add but at the same time, I find that bevy having different behaviour on different GPU divice with this issue, it seems that only show on Integrated GPU device. I have tried three different GPU divice,
|
Bevy version
main branch 518408d
Windows 10
AdapterInfo { name: "NVIDIA GeForce GTX 1070 Ti", vendor: 4318, device: 7042, device_type: DiscreteGpu, backend: Vulkan }
What went wrong
I was using the 0.7 release and the sprite was loading fine, but when I switched to the main branch 518408d it shows white outline around the sprite
this is how I'm spawning the sprite
The text was updated successfully, but these errors were encountered: