The International Simutrans Forum

 

Author Topic: Patch: change zooming routine  (Read 1840 times)

0 Members and 1 Guest are viewing this topic.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4493
  • Languages: EN, DE, AT
Patch: change zooming routine
« on: January 21, 2018, 09:56:51 AM »
While trying to fight some pixel glitches, I came up with the following patch. It changes the behavior of the zooming routine. There, from pixels on NxN (N=2,3,4,8) patches,
one pixel in the zoomed image is calculated. Currently, this pixel will be transparent if all pixels in the patch are transparent. In the patch, I changes this to make pixels transparent even if the patch is not completely transparent. The motivation was that tile images should be still of the same tile shape after zooming.

Here are two images: pak64 savegame, full zoom out.

Unpatched

Patched


What do you think?

Edit: here is a patched executable for windows: https://simutrans-germany.com/files/upload/sim-gdi-patched-zoom.exe.zip

Offline Leartin

  • Devotee
  • *
  • Posts: 1079
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Patch: change zooming routine
« Reply #1 on: January 21, 2018, 10:28:00 AM »
So currently, when you use dithering or transparency on the edge of an object, it becomes a solid shape when you zoom out - eg. dithered tree shadows. Do I understand correctly that this patch would somewhat help with that?

As far as these screenshots go, I think it looks much cleaner. I suppose zoomed out that far, it will make some things disappear, but since this is not intended to be used for playing, just for an overview, that should be fine.


EDIT: Will Look at the Executable first

Soooo... I couldn't look at much, since even after I thought I deactivated my Antivirus it still got deleted due to Sprisky.U!cl, probably a false positive.

But yes, it does fix an issue I had with transparent/dithered objects, which now slowly disappear instead of becoming more prominent, as they should. Eg. Winter forests are no longer a black mess due to all the branches. Other than that, I still think it looks a lot cleaner.
It's perhaps a bit problematic that the border of the mouse cursor disappears as well, as it makes it a lot harder to see the tinted tile. Not knowing much about how it works, would it be possible to have some elements like the mouse, perhaps a tile grid if activated, use the old zoom logic instead to make sure they stay visible?
« Last Edit: January 21, 2018, 10:48:35 AM by Leartin »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4493
  • Languages: EN, DE, AT
Re: Patch: change zooming routine
« Reply #2 on: January 21, 2018, 11:06:40 AM »
Here is a screenshot of pak192.comic winter trees. In current trunk, some trees degenerate to black blurbs.

You are right, markers, cursors, tile borders, etc, should be zoomed differently.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5368
  • Languages: EN, NO
Re: Patch: change zooming routine
« Reply #3 on: January 21, 2018, 11:31:15 AM »
Maybe Simutrans should have pre-calculated mipmaps?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4493
  • Languages: EN, DE, AT
Re: Patch: change zooming routine
« Reply #4 on: January 21, 2018, 12:04:06 PM »
You mean: zoom levels provided by pak files?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5368
  • Languages: EN, NO
Re: Patch: change zooming routine
« Reply #5 on: January 21, 2018, 12:26:32 PM »
Yes, but rather than another level of imagelists, it would be internal to an image through to simgraph, so they don't have their own image id.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9309
  • Languages: De,EN,JP
Re: Patch: change zooming routine
« Reply #6 on: January 21, 2018, 01:49:03 PM »
I think the real challenge are the intermediate levels. For me, the zoomed out world looks too empty, almost like a minimap. Maybe one rather needs a threshold in between other than none or all. With transparency it would be possible ...

Offline Leartin

  • Devotee
  • *
  • Posts: 1079
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Patch: change zooming routine
« Reply #7 on: January 21, 2018, 02:14:23 PM »
Here is a screenshot of pak192.comic winter trees. In current trunk, some trees degenerate to black blurbs.
Dead/Winter trees currently become large black blobs. With this patch, they become black stumps on largest zoom. Neither is ideal, but I prefer small black stumps over large black blobs ;)

I think the real challenge are the intermediate levels. For me, the zoomed out world looks too empty, almost like a minimap.
Which isn't that bad - If there actually was a zoom into a minimap-esque mode, that would be amazing.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1309
Re: Patch: change zooming routine
« Reply #8 on: January 21, 2018, 09:31:37 PM »
Static screenshots don't capture the effect of this patch at all...
At zoom 9, with the patch, quite a bit of detail goes missing - the tree trunks. When zooming in from there, I get the sensation of the trees growing faster than the terrain.
Without the patch, zooming in from 9, I get the effect of the trees staying large, and simply spacing farther apart.

IMHO, overall with patch is better than without, but It'd be nice if a little more detail could be maintained at zoom 9.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2524
  • Languages: EN
Re: Patch: change zooming routine
« Reply #9 on: January 22, 2018, 01:31:04 AM »
If Simutrans graphics were not stuck in pre 2000 this probably would not be a problem. As it is, Simutrans alpha is a hack and not true alpha as it falsely assumes linear RGB colour all the way (result is bad/poor blending logic).

For screen shots maybe a special screenshot mode which uses area averaging or captures a higher resolution image?
« Last Edit: January 22, 2018, 02:13:30 AM by DrSuperGood »