treeform / boxy

2D GPU rendering with a tiling atlas.
MIT License
102 stars 7 forks source link

Having the ability to set the internal textures filtering #53

Open SkyVault opened 1 year ago

SkyVault commented 1 year ago

My usecase for this is for games using pixel art, I have been scaling up my images so that the bi-linear filtering isn't as apparent, but I would like to be able to set the texture filtering to minNearest / magNearest.

treeform commented 1 year ago

I also want this, but actually most pixel games don't just set minNearest / magNearest as it looks terrible.

See here and how wavy it looks: https://www.shadertoy.com/view/ltBGWc

One needs to do manual filtering, and there are some tradeoffs.

https://csantosbh.wordpress.com/2014/01/25/manual-texture-filtering-for-pixelated-games-in-webgl/

I have tried to implement something like this but have not solved it yet.

You want to use mipmapping when pixels are small enough, when you zoom in and rotate you want the pixel to look more like little rectangles with AA ages:

image

That will make pixel art look great.

Scaling up pixel art might be more performant then custom filtering... I would have to test that out.

SkyVault commented 1 year ago

Yeah you are correct, this is a very hard problem I've been wanting to find a solution for, I also have a 3d project that uses a pixel art style and the attempts I've made to make that look good have all been pretty bad, but yeah I'm going to see what I can come up with for this project, I also got a lot of interesting reading to do, thanks for the response!