Topic: nearest neighbor / point filter
Kusy Topic Opener |
Posted at: 2024-04-27, 11:09
Sorry I feel like I asked this some time ago but can't find the post for the life of me. Is it possible to make Widelands not filter and blur the textures at all? As in use point filter / nearest neighbour filtering? Top Quote |
kaputtnik |
Posted at: 2024-04-29, 17:13
Are you referring to terrains? For terrains it is not possible anymore to make two terrains NOT blur. For an explanation see this post of the corresponding PR. In version 1.1 this was possible by changing the terrains dither_layer value: If two terrains had the same value for Top Quote |
Kusy Topic Opener |
Posted at: 2024-04-29, 18:36
No, I'm talking about texture filtering / resampling in general, not about blending. I'm not going to pretend I know much about OpenGL, but from what I see Widelands uses bilinear filtering when zooming in to resample textures. Is it possible to switch to use nearest/point filter instead? I did some edits to shader files but it mostly resulted in crashes. Also, wouldn't clamping to edges resolve the hack with textures being sampled at 0.99 UV size for terrains? https://www.khronos.org/opengl/wiki/Sampler_Object I'm asking because having textures blur out when zoomed in makes any attempt at creating pixelart adjacent assets kinda impossible and while I know it's a personal prefference, even when not using pixelart per se, I preffer the crisp look to blur. Edited: 2024-04-29, 19:02
Top Quote |
tothxa |
Posted at: 2024-04-29, 19:05
IMO this is only a problem (only actually visible) when upscaling, so the preferred solution is to provide high resolution images for all map objects in the game. I apologise for the slow progress of the blender re-exports...
I don't think that would give good results, nearest point is usually extremely ugly... Unless you want to use only integer scales (I don't think widelands helps in that, except when going to the max zoom of 4x), where the blocky images may sometimes be preferable to the blurred ones...
Well, looks like you know quite a bit about OpenGL after all (compared to me anyway ) so you may try to do it and open a PR if you can get something nice out of it. Any help is welcome. Top Quote |
Kusy Topic Opener |
Posted at: 2024-04-29, 19:17
High resolution images are only a solution to the problem if that's the approach you choose to take with art. Sorry, I edited the post in the mean time so to readress that. While I know this is the current approach to assets, having textures blur when zoomed in makes it impossible to work on assets that have a more retro / pixelart feel to it, if someone wanted to go for that look. Not having the option puts on hard limits on the art direction for addons. Edited: 2024-04-29, 19:18
Top Quote |
Kusy Topic Opener |
Posted at: 2024-04-29, 19:36
Which by the way I know can be a valid choice if you're aiming for high level of consistency. Top Quote |
tothxa |
Posted at: 2024-04-29, 20:53
If you go for the blocky look in an add-on, you can upscale your graphics without filtering to create the Top Quote |
tothxa |
Posted at: 2024-04-29, 20:54
And here are the used files (replace Top Quote |
Kusy Topic Opener |
Posted at: 2024-04-29, 21:37
Alas, the ground's still blured into oblivion No ammount of dancing around will change how the filtering affects some elements, not to mention doubling half the art assets doesn't exactly seem like a valid fix. I'll dig around with the shaders a bit more, see where it gets me. Top Quote |
Kusy Topic Opener |
Posted at: 2024-04-30, 09:01
Ok. I'm semi-sure I found a way to change how the textures filter but I can't get around making a build (errors galore), never built an app in my life and this didn't work out to be the first time. There are two instances of Changing parameters
I'll try to build this when I have the time to poke around later in the week unless someone who knows how to do it out of the box can confirm it works. Again, having this as an option in the game (a checkbox for nearest filtering / a droplist with the two or something in that vein) would be invaluable both from the perspective of players who prefer how it looks and anyone who wants to work on addons with a more pixelart feel to them. Edited: 2024-04-30, 09:03
Top Quote |