Menu

#130 Vertical tile scaling theme option

open
nobody
None
5
2019-07-27
2019-07-26
qubodup
No

It looks like tiles are scaled horizontally, then tiled. This is not ideal for square non-tiling tiles, see attachment based on https://opengameart.org/content/pastel-resources-tiles-96x96

scale = vertical or = y should scale vertically and center horizontally.

There is no theme.cfg scaling documentation, so perhaps this is already possible.

1 Attachments

Discussion

  • qubodup

    qubodup - 2019-07-26

    slightly better results with a prepared tileset (https://opengameart.org/content/pastel-resources-hex-tiles-55x64-and-64x55)

    However, it would benefit pixel art tilesets if it was possible to control the scaling interpolation and set it to none :)

     
  • Roland Clobus

    Roland Clobus - 2019-07-27

    Hello qubodup,

    There is documentation, but it is rather well hidden within the source file:
    https://sourceforge.net/p/pio/code/HEAD/tree/trunk/pioneers/common/gtk/theme.c

      Normally, all pixmaps are used in their native size and repeat over their
      area as needed (tiling). This doesn't look good for photo-like images, so
      you can add "scaling = always" in that case. Then images will always be
      scaled to the current size of a hex. (BTW, the height should be 1/cos(pi/6)
      (~ 1.1547) times the width of the image.) Two other available modes are
      'only-downscale' and 'only-upscale' to make images only smaller or larger,
      resp. (in case it's needed sometimes...)
    

    So the images would need to be WxH = 96x111 or 83x96 for optimal display. 55x64 is also good.
    There are tile sets that do not use scaling, but those images are really prepared for tiling: Classic, FreeCiv-like, Wesnoth-like
    The other tile sets that have non-tileable images have this factor of 1.1547: Iceland, Nouvellia, Tiny, ccFlickr.

    The current implementation shows all of the image, which means that first the width is used, and then on top and at the bottom there will be a slight tiling effect when using square tiles. If instead the height would have been used, you would get truncations of the image at the sides, which undoes the work of the tile creator. An option to scale in only one direction will give streched images, which needs to be compensated for when designing the images. Then it will be probably just a easy to use the factor 1.1547.

    So for a square tile set, I don't see the optimal solution for scaling. I propose to use the the factor of 1.1547 (and rounding up) when creating tiles, because that gives the nicest results.

     
  • qubodup

    qubodup - 2019-07-27

    Thanks for the info. Yeah, it's not too much to ask for theme designers to crop the image files.

    Regarding pixel art tiles, It would be nice to have the option to configure the theme to use GDK_INTERP_NEAREST rater than GDK_INTERP_BILINEAR, see enum GdkInterpType in https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Scaling.html

     

    Last edit: qubodup 2019-07-27
  • Roland Clobus

    Roland Clobus - 2019-07-27

    For the manual:
    GDK_INTERP_BILINEAR: Best quality/speed balance; use this mode by default.
    GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest and lowest quality mode. Quality is normally unacceptable when scaling down, but may be OK when scaling up.

    If I understand this correctly, GDK_INTERP_NEAREST will be extra ugly when scaling down, which will happen a lot on larger maps. Do you need the lower quality for performance reasons?

     
  • qubodup

    qubodup - 2019-07-27

    Downscaling - I hadn't though of that.

    Nearest neighbour scaling is best for pixel art - at least compared to bilinear filtering - see attachment as an example (480px upscaled from 96px, linear on the left, nearestneighbour on the right). If you're interested in supporting (and maybe even including/shipping) a theme based on https://opengameart.org/content/pastel-resources-tiles-96x96 then it'd look better. At least for upscaling - not sure about downscaling.

     

Log in to post a comment.