Godot version:
Godot 3.2 Alpha 3 (from your website)
OS/device including version:
Windows 10
Issue description:
When doing pixelated texture, resizing the Ninepatch changes its scale.
Steps to reproduce:
Minimal reproduction project:
https://i.imgur.com/VeQeuhQ.gifv
Notes: Godot 3.2 alpha 1 doesn't have this issue. Anything past alpha 1 has this issue.
CC @puthre maybe related to your PR?
@shmellyorc you'll have to have your ninepatch texture resolution smaller than what you will have on screen otherwise it will get scaled down. Previously (before #32170) it would just be distorted (but you wouldn't have seen that in your example as the margins in your example are the same everywhere).
So that's not a regression but a bugfix?
@puthre both scaling down and distortion is considered a bug when it comes to how 9 slices should work.
if the 9 slice is smaller then the texture it should start clipping starting with the center, then the edges, then the corners until it is completely invisible with a size of 0,0
@Shadowblitz16 I don't think I understand your proposal (or as I understand it it would not look very good except with some hand picked use cases). The main reason for my fix as far as I remember was that you could not use the 9 patch frame at all in Stretch Mode = 2D mode where your viewport size is can be much lower than the actual resolution of the device (which happens when you deploy on a mobile device) and you need to have textures much larger than the size of the viewport to match that screen resolution. Before my fix it didn't even distorted in the same way with GLES2 and GLES3.
If you don't want it to scale, just provide a smaller texture.
No this is horrible for pixel art we shouldn't have to modify our textures because someone decided to change how 9 patches have always worked.
if anything it should be a flag or a project setting to scale down these things.
you basically just broke everyone's projects that relied on these.
this is kinda why I get angry is because some person comes along and instead of just fixing the problem they do something that doesn't make sense or breaks backwards compatibility
9 slices are there to prevent the edges from being warped there is no point in them if they don't do this.
if you need to scale these things, implement a way to scale the canvas or the scale the 9slice.
@Shadowblitz16 While I can understand your frustration, I'll have to ask you to remain civil and avoid using making things personal. You may disagree with the change, but you shouldn't express anger, especially not against other community members. https://godotengine.org/code-of-conduct
Can anyone provide a reproduction project so that we can see what works and what doesn't?
@akien-mga Here is one
nine-patch.tar.gz
Try both with gles2 and gles3 as they have different implementation (gles3 is implemented in a shader).
Also having this issue with a broken downscaling after upgrading to Godot 3.2.1
It's nice there is a workaround for now, but I agree this is a bug/regression because NinePatches should never scale their corners (at least without some kind of flag allowing it set by the dev).
@naturally-intelligent What exactly is the work around here? I've been stuck on how to fix this for hours...
@Lucrecious Scale your texture down to be smaller than the resolution of the patch on screen.
Not scale - I think you mean to edit your 9P textures to have less stretch than the biggest use.
@puthre @naturally-intelligent
Sorry, I feel very dumb, but I literally don't understand what you guys are saying.
I don't know what "less stretch than the biggest use" means or "scale your texture to be smaller than the resolution of the patch".
Would it be possible for either one of you to provide a concrete example using actual numbers? An example that starts from a 9P that down scales and ends with it being fixed? Doesn't have to be a Godot file, just some text.
@Lucrecious The nine patch margins will only stretch down if it can't fit in the small space you allocate to it on screen (small relative to the patch texture resolution). Just try to scale down the image texture that you are using for the nine patch (using gimp or something similar) and you will see what I mean.
in 3.0, the textures wouldnt stretch (wouldnt change scale). The corners and the ninepatch would stop to the size of the corners. Ever past 3.0, I have to make very small textures.
@naturally-intelligent What exactly is the work around here? I've been stuck on how to fix this for hours...
If you look at this tutorial image:
https://tekeye.uk/android/examples/ui/android-9-patch-image-files
You will have to make middle sections 2,4,5,6, and 8 very small (ex: 1x1 pixel), while your corners (1,3,7,9) can be any size.
I spent the better part of a day in frustration thinking this was my fault, until I found this thread, so I feel your pain...
Confirmed that GLES2 implementation for tiling axis stretching doesn't work.
It looks identical to stretched mode as if it is the same option or acts the same.
This forces me to use GLES3 if I want to have my program's nine patches appear correctly.
I would much prefer keep using GLES2 for the wider compatibility.
Fixed by #42119.
Most helpful comment
No this is horrible for pixel art we shouldn't have to modify our textures because someone decided to change how 9 patches have always worked.
if anything it should be a flag or a project setting to scale down these things.
you basically just broke everyone's projects that relied on these.
this is kinda why I get angry is because some person comes along and instead of just fixing the problem they do something that doesn't make sense or breaks backwards compatibility
9 slices are there to prevent the edges from being warped there is no point in them if they don't do this.
if you need to scale these things, implement a way to scale the canvas or the scale the 9slice.