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

Implementing PixelArt scaling mode in ImageSampler #9349

Open
Veliladon opened this issue Aug 3, 2023 · 1 comment
Open

Implementing PixelArt scaling mode in ImageSampler #9349

Veliladon opened this issue Aug 3, 2023 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible

Comments

@Veliladon
Copy link

What problem does this solve or what need does it fill?

Right now we have two options for scaling with pixel art: Nearest and Linear. Nearest is great for integer scaling, Linear has the trademark blurriness that accompanies Bilinear filtering.

What solution would you like?

Cole Cecil has come up with an innovative way to take advantage of bilinear filtering using a custom vertex and fragment shader to implement arbitrary scaling factors with a minimal amount of blurriness:

https://colececil.io/blog/2017/scaling-pixel-art-without-destroying-it/

I think it would be great to implement on the 2D camera as a scaling method.

What alternative(s) have you considered?

I'm currently using nearest using only integer scaling factors. This would enable arbitrary scaling factors.

Additional context

I'd really like to help implement this because it'd be a great learning exercise. I'm just not sure where I'd start to implement a custom set of shaders into the pipeline.

@Veliladon Veliladon added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Aug 3, 2023
@Veliladon Veliladon changed the title Implementing PixelArt scaling mode in ImageSettings Implementing PixelArt scaling mode in ImageSampler Aug 3, 2023
@dmyyy
Copy link
Contributor

dmyyy commented Aug 3, 2023

Previous discussion on a pixel perfect shader: #1856

Seems like there is a pixel camera plugin here: https://github.com/drakmaniso/bevy_pixel_camera

It doesn't currently use a shader because of issues with sprites: drakmaniso/bevy_pixel_camera#11

As an aside - I think this makes sense in a 3d context as well for billboarded sprites. It makes sense to me to implement this as a custom material on Image - that way it can be used both in 2d/3d and avoids the issues bevy_pixel_camera has. There's several approaches that can be taken here so I'm curious what other people think.

Relevant video for 3d: https://youtu.be/d6tp43wZqps

@nicopap nicopap added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Aug 5, 2023
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

3 participants