Zoom problem

Hi guys, I have a question. Why are events blurred when zooming in rpg maker mz ?
I don't understand why this happens, everything else is not blurred.


blur.png


code:
const xPos = $gameMap.event(15).screenX();

const yPos = $gameMap.event(15).screenY();


$gameScreen.startZoom(xPos, yPos, 2, 60);
it partially depends on the mathematical formulae used, but basically the only way to prevent that "blur" is to only use full scale zooms like 200%, 300%, 400% and so on.

it's best explained with an example of a 2-pixel-picture zoomed 150%.
Let's say you have two pixels, one black and one white, and zoom to 150%.
2*150% are 3 - you now have a three-pixel picture.
but what are the colors of the three pixel?
left one remains black, right one remains white, but what is the middle pixel as a color?

giving it either black or white will distort the picture, because the divider line (while still crisp) will not be in the middle but to one side. Some mathematical fomulae do this, but the result is usually not good.

because of this a lot of other formulae mix color - black and white means grey, so they make the middle pixel grey.
And THAT is what you see as a blur -the colors mixed when the zoom tries to guess what color the new pixels should be.
and it also explains why the only crisp result is full zooms - in 200% you now have 4 pixel, two black and two white and everything looks as intended. But use a different zoom you'll get between pixel again.
I understand what you said, but I'm already using 200% when zooming in.

$gameScreen.startZoom(xPos, yPos, 2, 60);

I used this same code in rpg maker mv and it works perfectly :

Captura de tela 2022-10-21 093925.png



I don't understand why in rpg maker MZ this problem happens.
MZ defaults to nearest-neighbour scaling for the tilemap, and linear interpolation for everything else, e.g. map characters. I don't know why. 😴

If you load this as a plugin, does it help?
JavaScript:
/*:
 * @target MZ
 * @plugindesc Nearest-neighbour scaling for all bitmaps.
 * @help Free to use and/or modify for any project, no credit required.
 */
void (alias => {
  Bitmap.prototype.initialize = function(width, height) {
    alias.apply(this, arguments);
    this.smooth = false;
  };
})(Bitmap.prototype.initialize);
(The smooth property is MZ's internal toggle for nearest/linear scaling.)

Alternatively there are some existing "pixel-perfect" plugins out there, e.g.
Galenmereth knows their stuff, so I'd be surprised if that one doesn't work.
MZ defaults to nearest-neighbour scaling for the tilemap, and linear interpolation for everything else, e.g. map characters. I don't know why. 😴

If you load this as a plugin, does it help?
JavaScript:
/*:
 * @target MZ
 * @plugindesc Nearest-neighbour scaling for all bitmaps.
 * @help Free to use and/or modify for any project, no credit required.
 */
void (alias => {
  Bitmap.prototype.initialize = function(width, height) {
    alias.apply(this, arguments);
    this.smooth = false;
  };
})(Bitmap.prototype.initialize);
(The smooth property is MZ's internal toggle for nearest/linear scaling.)

Alternatively there are some existing "pixel-perfect" plugins out there, e.g.
Galenmereth knows their stuff, so I'd be surprised if that one doesn't work.
this works perfectly!! Also, I was able to understand the problem too, Thank you!!

Original thread: https://forums.rpgmakerweb.com/threads/zoom-problem.152115/