Windowskin Bleeding/Visual Glitching

At 1366x768 resolution (and several other resolutions I've tried), there's a visual glitch where the windowskin will incorrectly render in things like the choice menu, the show message text box and even pause menus. At first I thought a plugin could've been causing an issue but then I was able to replicate the problem on a clean project. I noticed with time the "bleed" was different areas of the windowskin that shouldn't make sense, like text colors and the cursor highlight color. Sometimes it'll appear as misaligned elements inside of the windowskin, sometimes as stripes.
What sucks is that there's no real pattern to it, it's not a specific number of characters that causes this or number of choices.
I really hope the issue isn't my resolution.
Has anyone else dealt with this problem? Anyone have a solution or a workaround (preferably that allows me to maintain my resolution of choice), or any ideas on how to tackle this?

1718366618905.png
1718366624585.png
Have you tried any sort of scaling plugin? That might help you. Seems like the resolution is stretching the window skin "too" much.
Have you tried any sort of scaling plugin? That might help you. Seems like the resolution is stretching the window skin "too" much.
Thanks for your help, but unfortunately it doesn't tackle the issue I'm having. A black bar now appears on the side of the choice menu and the windowskin itself gets really negatively affected by the window scaling, I'm guessing cause the plugin is maybe oriented towards games with smaller resolutions. In my case, fullscreen looks really distracting with the plugin enabled.

1718368560910.png


I was able to find more people discussing this on Reddit, recommending a couple plugins there but none of them seem to work for me.
Have you tried manually editing the windowskin now with that plugin? Maybe remove a single line of pixels on the image that appears next to the text box outline? Might make it work for you. Just have to see if it messes anything else up visual wise. Make a backup of you windowskin first.
Have you tried manually editing the windowskin now with that plugin? Maybe remove a single line of pixels on the image that appears next to the text box outline? Might make it work for you. Just have to see if it messes anything else up visual wise. Make a backup of you windowskin first.
That was my approach on my main project before coming here looking for a fix. I worked around the problem by modifying the windowskin, erasing lines, using mostly transparent windows to avoid giving away the glitch, but it's still very frustrating.

I just wish for RPG Maker to work out of the box with its intended features lol.
That was my approach on my main project before coming here looking for a fix. I worked around the problem by modifying the windowskin, erasing lines, using mostly transparent windows to avoid giving away the glitch, but it's still very frustrating.

I just wish for RPG Maker to work out of the box with its intended features lol.

I see. There might be some better solutions from other folks here for you then. There may even be a better plugin for you to use also.
try drawing the same structure of the skin in a new bitmap, maintaining proportions.
don't worry about colors or transparency, just copy the same pattern, with a brush with no feathering, and a solid mask.
see if that still tears the image.
if it doesn't, then the problem is the image, not the engine.
The choice window's width is based on the largest width over all choice texts. However, the core engine's text measurement system uses CanvasRenderingContext2D#measureText, which I believe can return fractional values.

You could try importing this as a plugin to see if it helps:
JavaScript:
/*:
 * @target MZ
 * @plugindesc Ensure integer choice window width.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/169512/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (alias => {
  Window_ChoiceList.prototype.windowWidth = function() {
    return Math.ceil(alias.apply(this, arguments));
  };
})(Window_ChoiceList.prototype.windowWidth);
I.e. round the choice window width up to the next integer.

(I'm aware of a similar issue with centred Show Choices: due to its width calculation, the window may be positioned at fractional screen coordinates, which can afflict the entire window with aliasing/blurriness.)
The choice window's width is based on the largest width over all choice texts. However, the core engine's text measurement system uses CanvasRenderingContext2D#measureText, which I believe can return fractional values.

You could try importing this as a plugin to see if it helps:
JavaScript:
/*:
 * @target MZ
 * @plugindesc Ensure integer choice window width.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/169512/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (alias => {
  Window_ChoiceList.prototype.windowWidth = function() {
    return Math.ceil(alias.apply(this, arguments));
  };
})(Window_ChoiceList.prototype.windowWidth);
I.e. round the choice window width up to the next integer.

(I'm aware of a similar issue with centred Show Choices: due to its width calculation, the window may be positioned at fractional screen coordinates, which can afflict the entire window with aliasing/blurriness.)
Thank you for taking the time to put this together, unfortunately the issue persists.

try drawing the same structure of the skin in a new bitmap, maintaining proportions.
don't worry about colors or transparency, just copy the same pattern, with a brush with no feathering, and a solid mask.
see if that still tears the image.
if it doesn't, then the problem is the image, not the engine.
I think it'd be weird that the default windowskin that comes with a fresh, up-to-date RPG Maker MZ project would be problematic. I blocked out all the proportions the windowskin reserves for all its seperate elements, text colors, the pattern, the body, the border, etc. and you can see the tearing is still there.
1718373192041.png
1718373246091.png

(same windowskin, same proportions, same 192x192 size)

It's such a weird issue.
then that translates to an error a fraction of a pixel off, which is even rarer than a rounding error.
what's the distance between the artifacts, in pixels? is it constant if you render in another resolution?

the only thing that is tiled when building the window, is the background pattern.
everyhing else is stretched, so if anything it must be an internal error when offsetting that tile pattern
then that translates to an error a fraction of a pixel off, which is even rarer than a rounding error.
what's the distance between the artifacts, in pixels? is it constant if you render in another resolution?

the only thing that is tiled when building the window, is the background pttern.
everyhing else is stretched, so if anything it must be an internal error when offsetting that tile pattern
If I change the resolution from say, 1366x768 to 1280x720 the problem seemingly goes away at first, but then I might fill the choice window with text of a different length, and the artifacts appear again.
1718384829808.png
1718384840594.png

In both cases (the 1366x768 and the 1280x720 resolution), the artifacts are exactly 95 pixels apart.
I should also note I haven't been able to find a specific number of letters that causes this, and only in this example does it happen in the choice window, I've had it happen in the normal "show text" message box.

I've tried different numbers of characters, monospaced vs proportional fonts, different font sizes, and found no correlation. Sometimes these things just show up and are distracting and ruin custom skins.

Again, I've tried working around the issue, just editing the text till I don't see the artifacts anymore, hiding windowskins and replacing them with static pictures, manipulating the windowskin, etc. But I shouldn't have to do that for a software I paid full price for.
the artifacts are exactly 95 pixels apart.
96 is a common go-to number for calculations.
like hitting an out of tune string in a piano in certain melodies.
¬.¬ hmmmmmm....

one thing I can think of, is that maybe the engine builds the individual tile to repeat out of the window skin at 48p, then stretches it to 96, and in that stretching is where the tearing appears, because of the blurring.

is the pattern consistent with the skin texture? or is it stretched?
if it's stretched, that's what I mean: it's trying to cover more space with a larger sprite because of the larger resolution it's working at.
if not, then the engine is grabbing the tile just a fraction of a pixel out of alignment.
which is all kinds of weird, because an exact fixed measurement never slips off.
96 is a common go-to number for calculations.
like hitting an out of tune string in a piano in certain melodies.
¬.¬ hmmmmmm....

one thing I can think of, is that maybe the engine builds the individual tile to repeat out of the window skin at 48p, then stretches it to 96, and in that stretching is where the tearing appears, because of the blurring.

is the pattern consistent with the skin texture? or is it stretched?
if it's stretched, that's what I mean: it's trying to cover more space with a larger sprite because of the larger resolution it's working at.
if not, then the engine is grabbing the tile just a fraction of a pixel out of alignment.
which is all kinds of weird, because an exact fixed measurement never slips off.
I tried to troubleshoot it by making marks on the Body section of the windowskin with a magenta line.
1718389012721.png
1718389016639.png

There was no real consistency between the same skin stretched at different resolutions and the location of the artifact.
but the first artifact starts almost perfectly where the actual tiling should start, right on the inner edge of the frame, and repeats at 96p intervals.
can you try a 2000p resolution or higher just to brute-force it?
if the gap widens, then it's definitely a calculation problem... it should tile based on the size of the tile, edge to edge, not the size of the window.
but the first artifact starts almost perfectly where the actual tiling should start, right on the inner edge of the frame, and repeats at 96p intervals.
can you try a 2000p resolution or higher just to brute-force it?
if the gap widens, then it's definitely a calculation problem... it should tile based on the size of the tile, edge to edge, not the size of the window.
The max resolution MZ allows is 2000 pixels, I have no clue how I'd go higher than that.
1718391293296.png

I should also point out that my monitor is 1920x1080 so I'm struggling to get an accurate pixel-perfect screengrab like before, that said the artifact is still clearly visible.
OK I experimented a bit and managed to reproduce this by simply adding 0.5 to any window's x or y position. Perhaps tiling sprites handle fractional x/y inconsistently or something.

My test case has been to open the pause menu and enter this into the console:

SceneManager._scene._statusWindow.x += 0.5
By default this causes vertical seams to appear, much like your screenshots.

If you like, here's a couple of fixes to try~
  1. A specific fix for Show Choices: rounds the window's X position to an integer.
    Spoiler: plugin code
    JavaScript:
    /*:
     * @target MZ
     * @plugindesc Force Show Choices to display at integer coordinates.
     * @url https://forums.rpgmakerweb.com/threads/169512/
     * @help Free to use and/or modify for any project, no credit required.
     */
    void (alias => {
      Window_ChoiceList.prototype.windowX = function() {
        return Math.round(alias.apply(this, arguments));
      };
    })(Window_ChoiceList.prototype.windowX);

  2. Generic, but will probably break any slow-moving (< 0.5 px/frame) windows, sprites, etc.
    Spoiler: plugin code
    JavaScript:
    /*:
     * @target MZ
     * @plugindesc Force display objects to integer coordinates.
     * @url https://forums.rpgmakerweb.com/threads/169512/
     * @help Free to use and/or modify for any project, no credit required.
     */
    void (() => {
      const ALL = true;
      const g = () => ({
        x: {
          get: function( ) { return this.position.x; },
          set: function(v) { this.transform.position.x = Math.round(v); },
          enumerable: false,
          configurable: true
        },
        y: {
          get: function( ) { return this.position.y; },
          set: function(v) { this.transform.position.y = Math.round(v); },
          enumerable: false,
          configurable: true
        }
      });
      if (ALL)
        Object.defineProperties(PIXI.DisplayObject.prototype, g());
      else
        for (const c of [Window])  // Sprite, TilingSprite, Scene_Base
          Object.defineProperties(c.prototype, g());
    })();
[Edit: corrected enumerable: true to false for y property descriptor in second spoiler.]
OK I experimented a bit and managed to reproduce this by simply adding 0.5 to any window's x or y position. Perhaps tiling sprites handle fractional x/y inconsistently or something.

My test case has been to open the pause menu and enter this into the console:

SceneManager._scene._statusWindow.x += 0.5

By default this causes vertical seams to appear, much like your screenshots.

If you like, here's a couple of fixes to try~
  1. A specific fix for Show Choices: rounds the window's X position to an integer.
    Spoiler: plugin code
    JavaScript:
    /*:
    * @target MZ
    * @plugindesc Force Show Choices to display at integer coordinates.
    * @url https://forums.rpgmakerweb.com/threads/169512/
    * @help Free to use and/or modify for any project, no credit required.
    */
    void (alias => {
      Window_ChoiceList.prototype.windowX = function() {
        return Math.round(alias.apply(this, arguments));
      };
    })(Window_ChoiceList.prototype.windowX);

  2. Generic, but will probably break any slow-moving (< 0.5 px/frame) windows, sprites, etc.
    Spoiler: plugin code
    JavaScript:
    /*:
    * @target MZ
    * @plugindesc Force display objects to integer coordinates.
    * @url https://forums.rpgmakerweb.com/threads/169512/
    * @help Free to use and/or modify for any project, no credit required.
    */
    void (() => {
      const ALL = true;
      const g = () => ({
        x: {
          get: function( ) { return this.position.x; },
          set: function(v) { this.transform.position.x = Math.round(v); },
          enumerable: false,
          configurable: true
        },
        y: {
          get: function( ) { return this.position.y; },
          set: function(v) { this.transform.position.y = Math.round(v); },
          enumerable: true,
          configurable: true
        }
      });
      if (ALL)
        Object.defineProperties(PIXI.DisplayObject.prototype, g());
      else
        for (const c of [Window])  // Sprite, TilingSprite, Scene_Base
          Object.defineProperties(c.prototype, g());
    })();
Thank you so much for taking the time and effort to experiment on this, that's incredibly generous of you! But I feel so embarrassed to say that neither one of these seem to have affected the issue .

That said, I found the weirdest remedy (but hey if it works, it works. Right?), which is any time those lines show up to add a thin space character ( ), and then the lines just magically disappear, ain't that weird? A normal space doesn't have the same effect, but particular character (also apostrophes and commas) gets rid of the lines, and the thin space is almost imperceptible.

The one thing I'm the most curious about is, is this just on my end?
add a thin space character ( ), and then the lines just magically disappear
adding 0.5 to any window's x or y position
you know.... I had to fix an alignment issue a while back in Ace:

which was due to how the window had to shrink or expand to fit the text, with monospace types.
....but this shouldn't even be related!
mine was an issue with draw_text(), this is an issue with the window's background, which is independent of the text!

one last test tho, for the lolz by now.
does it still happen if you use a pixel font? or anything other than the default?
you know.... I had to fix an alignment issue a while back in Ace:

which was due to how the window had to shrink or expand to fit the text, with monospace types.
....but this shouldn't even be related!
mine was an issue with draw_text(), this is an issue with the window's background, which is independent of the text!

one last test tho, for the lolz by now.
does it still happen if you use a pixel font? or anything other than the default?
Yes it does. I've tried it with different fonts, both monospaced and proportional, pixel perfect and otherwise.

It's really such a bizarre bizarre issue, but as it stands the bandaid of adding a thin space at the start/end of a choice or text box is good enough for me.
That said, I found the weirdest remedy (but hey if it works, it works. Right?), which is any time those lines show up to add a thin space character ( ), and then the lines just magically disappear, ain't that weird? A normal space doesn't have the same effect, but particular character (also apostrophes and commas) gets rid of the lines, and the thin space is almost imperceptible.
Oh. Great! 😮‍💨 Hopefully that's not just a fluke.
Spoiler: thoughts
I would understand if adding a narrow character works on a largest-width line of a choice window, since that could "sufficiently" cancel out fractional pixels for the renderer. Like @gstv87 says, though, I don't know how a text change would affect the background of a window that does not link its width to its text.

I tried to reproduce your first screenshot on my end, but I didn't see any gaps:

system2.png
screenshot.png
I did some other quick tests based on this: different choice texts, added a message, changed the screen/UI sizes, changed System 1 -> Window Color, painted different tiles on the map. They all looked just as seamless to me, though. 😅

Perhaps it's a GPU issue...you may want to make sure your graphics drivers are up-to-date. Also:
  • Help -> About shows your editor version. The latest version as of writing this is 1.8.0.
  • Game -> Update Corescript shows your project code version, and lets you update it.

Original thread: https://forums.rpgmakerweb.com/threads/windowskin-bleeding-visual-glitching.169512/