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,114
Reaction score
3,172
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,114
Reaction score
3,172
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 Profile Posts

no longer using rm2k3
Don't you hate when you're trying to sleep and suddenly the smoke detector needs batteries? That's exactly what happened to me. Now I'm sluggish and tired after that darn thing started chirping at 11:30 at night. Man I wish I had one of those smart smoke detectors that sends a message to your phone way before it starts chirping.
Interior of a bus, may do more vehicle interiors :kaoswt2:
1670089782219.png
I can hardly believe it is the third day of Christmas and I have yet to put up decorations! Spending my morning cooking breakfast and getting them up.
https://itch.io/s/83641/1-week-sale Do you want a Roguelike game like a turn-based Hades? Get Zodiac Hunters now while it's on sale!

Forum statistics

Threads
127,013
Messages
1,183,192
Members
166,875
Latest member
LottaSpice
Top