candlesonfir3

Villager
Member
Joined
Sep 29, 2022
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
So, basically, im using a simple script i found somewhere to force nearest neighbor scaling for some things, and it works, except when it doesn't. I'm using this:
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST
ImageManager.loadBitmap = function(folder, filename, hue, smooth) {
if (filename) {
var path = folder + encodeURIComponent(filename) + '.png';
var bitmap = this.loadNormalBitmap(path, hue || 0);
//console.log("disabling smoothing for "+path);
bitmap.smooth = false; return bitmap;
} else {
return this.loadEmptyBitmap();
}
};

And with the breathing animation from rexal's animatedSVEnemies it uses nearest neighbor scaling, which is nice, cool, exactly what i want. But then using SRdude's walk character battlers, the scaling is awfully blurry to the point of ruining the art style. i'm not sure why this is happening, or if there's any fix for it that isn't completely recoding the plugin.

Example:
difference.png
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
4,140
Reaction score
3,190
First Language
EN
Primarily Uses
RMMZ
Is your loadBitmap override plugin loading after the others (Rexal/SRD) in the Plugin Manager?

I'd suggest something like this instead, for a better chance of compatibility:
JavaScript:
/*:
 * @target MV
 * @plugindesc Nearest-neighbour scaling for all bitmaps.
 * @help Free to use and/or modify for any project, no credit required.
 */
void (function() {
  var alias = ImageManager.loadBitmap;
  ImageManager.loadBitmap = function(folder, filename, hue, smooth) {
    return alias.call(this, folder, filename, hue, false);
  };
})();
I.e. call the original loadBitmap as usual, except smooth = false in all cases. Again, this should be loaded after any other plugin that changes loadBitmap.
 

candlesonfir3

Villager
Member
Joined
Sep 29, 2022
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
I.e. call the original loadBitmap as usual, except smooth = false in all cases. Again, this should be loaded after any other plugin that changes loadBitmap.
I replaced the older nearest neighbor plugin i was using with that, and changed the order, but still no dice. I'm pretty confused. i have a feeling somehow SRD's plugin is scaling things differently? i'm not a coder, but it doesn't call loadBitmap at all
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
4,140
Reaction score
3,190
First Language
EN
Primarily Uses
RMMZ
Drat. There have been discussions about getting pixel-perfect graphics in RMMV, but I don't remember what the solutions were. Hopefully I'm missing something. :kaoslp:

Ideas:
  1. What's the width/height (px) of each of those sprites? I notice some code in SRD's plugin that seems to give sprites with odd (i.e. not a multiple of 2) frame width a fractional x value. Not sure how nearest-neighbour scaling handles that.

  2. I notice Rexal's plugin actually sets smooth to true on the enemy sprites (line 372), i.e. it seems to be using linear scaling, not nearest-neighbour. Perhaps that's causing the conflict in some way...?

  3. Have you tried:
    • Turning off all plugins except SRD's?
    • Turning off all plugins except Rexal's?
    • Turning off all plugins except the SRD and Rexal ones?
    • Changing which of the SRD/Rexal plugins loads first?
    As always, remember to save your project to apply Plugin Manager changes before each test.
i have a feeling somehow SRD's plugin is scaling things differently? i'm not a coder, but it doesn't call loadBitmap at all
Not directly: it calls ImageManager.loadCharacter, which calls loadBitmap. Then it looks like it blits it to a new bitmap for some reason. (I don't think that'll be a problem, though, because the core scripts have new bitmaps default to "not smooth", i.e. nearest-neighbour scaling.)
 

candlesonfir3

Villager
Member
Joined
Sep 29, 2022
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
  1. Have you tried:
    • Turning off all plugins except SRD's?
    • Turning off all plugins except Rexal's?
    • Turning off all plugins except the SRD and Rexal ones?
    • Changing which of the SRD/Rexal plugins loads first?
    As always, remember to save your project to apply Plugin Manager changes before each test.
I tried all of these things, to no avail.

I even made a dedicated plugin with just the forced nearest scaling plugin and SRD's walk sprite battling one, and it has the same result:
RESULT.PNG

I have no idea why it's happening with specifically this plugin and not any others but at this point I might just try something else for the battle system
 

candlesonfir3

Villager
Member
Joined
Sep 29, 2022
Messages
6
Reaction score
1
First Language
English
Primarily Uses
RMMV
Small update: I went back to this, could still absolutely not get the scaling in SRD's plugin to work the way i want, but i realized I could just scale up the walksprites manually and have a second sprite sheet for that and.. it works perfectly!

yay.PNG

still very confused why i couldnt get it to do clean scaling in the first place, but ah well. i figured something out
 

Latest Threads

Latest Posts

Latest Profile Posts

KDS
Hey guys! Iam currently updating my free digital art shop , let me know if you need anything done :) https://forums.rpgmakerweb.com/index.php?threads/kds-free-open-digital-art-shop.17097/
Hello! I’d like to ask where is a good place to start logging about my game dev progress as production of my game goes forth
In one of our campus classrooms was a bag full of stuff people forgot there... my bag. That I forgot there xD
You know your room is too tiny for how much stuff you have when it gives you literal insomnia. I just cleared a bunch of stuff out and man it feels good!
1670381555475.png
Meet the Kernel. You encounter him in cyberspace. He's important!

Forum statistics

Threads
127,098
Messages
1,183,961
Members
167,026
Latest member
silverbell
Top