Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Pixel Bleeding Between Tiles #1

Closed
zicklag opened this issue Jan 28, 2021 · 6 comments
Closed

Pixel Bleeding Between Tiles #1

zicklag opened this issue Jan 28, 2021 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@zicklag
Copy link
Member

zicklag commented Jan 28, 2021

On one map, which I unfortunately can't share because of non-free assets, has an issue when zooming in and out in the display_map example, where there will be a brief flash of bleeding pixels in between the tiles. I believe this is due to mipmapping or level of detail as it seems to be related to zooming in and out only and tends to be accompanied by a drop in frame rate.

First we need to get a map to re-produce with and second we need to figure out what's causing the issue.

@zicklag zicklag added bug Something isn't working help wanted Extra attention is needed labels Jan 28, 2021
@zicklag zicklag pinned this issue Jan 28, 2021
@zicklag zicklag changed the title Pixel Bleeding Between Tiles on Some Maps When Zooming in and Out Pixel Bleeding Between Tiles on Some Maps When Zooming Quickly Jan 28, 2021
@zicklag zicklag changed the title Pixel Bleeding Between Tiles on Some Maps When Zooming Quickly Pixel Bleeding Between Tiles Jan 29, 2021
@zicklag
Copy link
Member Author

zicklag commented Jan 29, 2021

Ah, I just found that the pixel bleeding seems to be only happening vertically now, and it happens more drastically when resizing the screen. Still need to get a map to reproduce on with a free artpack.

@zicklag
Copy link
Member Author

zicklag commented Jan 30, 2021

Another discovery! With the merging of bevyengine/bevy#400, if you setup the camera like the example below, there are no lines for my test map! But at different settings for the scale of the map and the orthographic projection, they show up again. Not sure what it means, but it's another clue to the puzzle. 🕵️‍♂️

    commands
        // Spawn the map
        .spawn(LdtkMapBundle {
            map: asset_server.load("maps/map.ldtk"),
            config: LdtkMapConfig {
                set_clear_color: true,
                scale: 3.0,
                level: std::env::args()
                    .nth(2)
                    .map(|x| x.parse().unwrap())
                    .unwrap_or(0),
            },
            transform: Transform::from_translation(Vec3::new(0.0, 0.0, 1.0)),
            ..Default::default()
        })
        .spawn(SpriteBundle {
            material: materials.add(ColorMaterial::texture(texture)),
            transform: Transform::from_translation(Vec3::new(0.0, 100.0, 1.1)),
            ..Default::default()
        })
        // And the camera
        .spawn(OrthographicCameraBundle {
            orthographic_projection: OrthographicProjection {
                scaling_mode: ScalingMode::FixedVertical,
                far: 1024.,
                scale: 500.,
                ..Default::default()
            },
            ..OrthographicCameraBundle::new_2d()
        });

@zicklag
Copy link
Member Author

zicklag commented Feb 5, 2021

This is no longer happening on Bevy master! I am no longer able to reproduce on the maps that I had previously experienced the glitch on. I'm closing for now, hoping it doesn't pop up again. For reference if we ever need to find out possibly what changed in the event of a regression, the working commit on master is: 5b115397baf15f66e40b50ccacbc4a1422937abb.

@zicklag zicklag closed this as completed Feb 5, 2021
@zicklag
Copy link
Member Author

zicklag commented Feb 5, 2021

Nevermind. 😞 It appears that enabling backface culling seems to help the performance enough that the issue happens less often, but it still happens. The effect seems to be related to the load of my system. For instance, when rendering on my CPUs, the effect is more common while also compiling rust while the game is running.

@zicklag zicklag reopened this Feb 5, 2021
@zicklag
Copy link
Member Author

zicklag commented Apr 19, 2021

I think the solution to this would be to render the map to a low-resolution framebuffer and then to use that framebuffer as the texture for a scaled up quad. I don't know how to do that with Bevy's current rendering abstraction, or whether or not that's possible yet, but that is how Bevy Retro works and it has absolutely no rendering artifacts.

@zicklag
Copy link
Member Author

zicklag commented Aug 9, 2021

Bevy LDtk is getting merged into Bevy Retrograde so I'm closing this issue and archiveing the repo. Soon Bevy Retrograde will support Bevy's renderer ( katharostech/bevy_retrograde#41 ) which will allow you to use bevy_retrograde_ldtk alone with out-of-the-box Bevy, removing the need to have separate plugins for Bevy and Bevy Retrograde.

You won't be able to comment after the repo is archived, but you can redirect any questions or comments to the Bevy Retrograde discussions page!

@zicklag zicklag closed this as completed Aug 9, 2021
@zicklag zicklag unpinned this issue Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant