Precise zooming

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
User avatar
cKomuHKa
Posts: 29
Joined: July 20th, 2012, 8:45 pm
Location: Russia

Precise zooming

Post by cKomuHKa »

Can I somehow zoom a game screen without blurring it?
Unit sprites are too small for me. I want to increase their size (x2 for example), but I do not want to see blurred pixelart.

Image
Last edited by cKomuHKa on September 12th, 2014, 6:39 pm, edited 1 time in total.
User avatar
Dugi
Posts: 4965
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Precise zooming

Post by Dugi »

cKomuHKa wrote:Can I somehow zoom a game screen whithout blurring it?
No, you can't.

You can try a workaround, half your screen resolution and don't zoom.
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Precise zooming

Post by iceiceice »

If you are willing to recompile the game from source, you could probably turn off whatever aliasing it is doing, but it doesn't look like you can do that otherwise. Maybe we should add this to 1.14 as an advanced preference or something.
User avatar
cKomuHKa
Posts: 29
Joined: July 20th, 2012, 8:45 pm
Location: Russia

Re: Precise zooming

Post by cKomuHKa »

iceiceice wrote:Maybe we should add this to 1.14 as an advanced preference or something.
That would be great.
User avatar
Crow_T
Posts: 851
Joined: February 24th, 2011, 4:20 am

Re: Precise zooming

Post by Crow_T »

iceiceice wrote:If you are willing to recompile the game from source, you could probably turn off whatever aliasing it is doing, but it doesn't look like you can do that otherwise. Maybe we should add this to 1.14 as an advanced preference or something.
+1 to user preference, and as a side note how does one turn the anti-aliasing off in the source?
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Precise zooming

Post by iceiceice »

Let me emphasize that I use the word "probably" because I don't know for a fact that you can.
Spoiler:
Edit: Okay, actually I got curious and decided to peek at the code and see if my educated guess was right. Turns it out was *not*, you probably cannot easily do this... so you might want to just forget I ever mentioned it :doh:
Spoiler:
Last edited by iceiceice on September 12th, 2014, 11:22 pm, edited 1 time in total.
Reason: spoilered some speculations that turned out not to be accurate
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Precise zooming

Post by iceiceice »

Okay, actually I had another idea about this and came back to it, one thing lead to another, I think I can tell you at least one way that seems to work now. No promises that it's really doing the right thing, but it seems to give that chunky, no blur feel.

It requires source code modifications, but they are quite small, just changing 3 lines. You can do it yourself, or I provide a patch file below (but you need to figure out how to use some tool to apply it then, so pick your poison.)

Edit: The patch is now moot, see next post.
patch
All of the below is based on 1.12 branch at git revision 34b383a.

There's two steps:
1. Increase the default zoom value by a multiple.
Spoiler:
2. Disable the bilinear interpolation, by setting the neighborhood size to always be a single pixel.
Spoiler:
Results:

http://imgur.com/a/A5dc7#0

You can definitely notice the increased chunkiness on the Drake leaders. Also, I think the horseman looks more like what you were saying. Also the skeleton archer bowstring looks especially nice.

If you zoom out with this version, it will definitely look much worse because there will be no blending at all... because the patch changes the default zoom value, if you click in the upper right on the magnifying glass, it will zoom back to whatever your preferred settings (144 or 288) was.

Patch:

As an alternative you can use this patch file instead of modifying the source by hand.
patch
Download the .patch file which I have attached to this thread, and place it at the root of your wesnoth repo. (So, in the folder "wesnoth". If you don't have a repo, follow these instructions: WesnothRepository#Download.)

For best results use it as follows: ($ is your prompt, you type that line, the following lines are git's response)

If you don't have git, you can try to apply it using another program to whatever 1.11.x or 1.12.x source you have, but there are no guarantees that it will apply smoothly at a different revision. I'm going to assume here that you are using git.

$ git checkout 34b383a
[spoiler]Note: checking out '34b383a'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 34b383a... update changelog[/spoiler]
$ git status
[spoiler]HEAD detached at 34b383a
Untracked files:
(use "git add <file>..." to include in what will be committed)

0001-Default-zoom-factor-x2-and-disable-bilinear-interpol.patch[/spoiler]
$ git apply 0001-Default-zoom-factor-x2-and-disable-bilinear-interpol.patch
$ git status
[spoiler]HEAD detached at 34b383a
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: src/display.cpp
modified: src/sdl_utils.cpp

Untracked files:
(use "git add <file>..." to include in what will be committed)

0001-Default-zoom-factor-x2-and-disable-bilinear-interpol.patch[/spoiler]


Now you can compile and run wesnoth.
Attachments
0001-Default-zoom-factor-x2-and-disable-bilinear-interpol.patch
patch which disables interpolation in wesnoth rendering, for 1.12 branch
(1.44 KiB) Downloaded 291 times
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Precise zooming

Post by iceiceice »

Update:

It was eventually decided that the blurry behavior when you zoom in is considered a bug. It has now been fixed, the above patch is no longer necessary, you will get results such as that by default instead.

Commit: https://github.com/wesnoth/wesnoth/comm ... a437a2920d
Post Reply