NeRdTheNed / MC-TextureGen

A Java program that programatically generates textures generated by certain versions of Minecraft at runtime, and then saves them to individual files.
The Unlicense
12 stars 1 forks source link

Text based textures generated by MC-TextureGen may differ from official generated textures (larger sample size needed) #22

Open muzikbike opened 2 years ago

muzikbike commented 2 years ago

I dreaded making this discovery...

This is the version generated by the program: Missing_Texture_Java_13w02a_to_13w17a

And this is the texture cropped out from the debug.stitched-(terrain/items).png from 13w02a: Missing_Texture_(Windows)_JE2

There are just minimal differences in the "xtu" for whatever reason.

Both of these are generated in Windows 10 version 2004. I'm not sure what version the Java bundled with the launcher is (8?).

Here are the two texture atlases generated by 13w02a: stitched_terrain stitched_items :

muzikbike commented 2 years ago

Pre-13w02a seems to have the same difference in the x. 2021-09-18_14 08 15

muzikbike commented 2 years ago

Judging by all the screenshots and other info I could dredge up on both pre-13w18a missing textures, the wonky x and co. seem to be the only type that ever existed, rather than there being a whole array of different pixel differences across characters inconsistent across platforms or even sessions, at least from what I saw. So hopefully this news isn't too terrible.

https://www.minecraftforum.net/forums/minecraft-java-edition/discussion/175116-the-secret-text-in-paintings?comment=14

NeRdTheNed commented 2 years ago

:/ I really thought I covered everything, evidently I didn't. Really sorry, I'll look at this today after I've woken up a bit.

NeRdTheNed commented 2 years ago

@muzikbike I found another one. Java 1.6.0_65-b14-468 (Apple legacy Java 6 runtime), MacOS 10.14.6.

I've seen both of these variations in bug reports, so I'm not sure which is supposed to be the correct one. I think I'll temporarily note that the generator looks to be inaccurate in the README until I fix whatever is causing this. I'm really sorry about the inconvenience!

muzikbike commented 2 years ago

On the topic: I'll need to check this more rigorously, but it seems the "unknown" OS I posted earlier might have been Ubuntu according to some recent samples.

What version of Java did you use to generate the original Mac version you posted, anyway?

I also think that this missing texture generator should be moved to the deterministic category, or to a new "system-deterministic" category, since it's much closer to stuff like the newer missing textures than it is to lava and co.

NeRdTheNed commented 2 years ago

@muzikbike I believe that the cause of this issue is that you're running MC-TextureGen with a different version of Java than the one you used to run Minecraft with!

Minecraft 1.5.2, Java 1.8.0_51 (Windows 10): debug stitched_terrain java 8 Cropped: out_8-0

Minecraft 1.5.2, Java 11.0.10 (Windows 10): debug stitched_terrain java 11 Cropped: out_11-0

Running MC-TextureGen with each respective version of Java produces results identical to the dumped textures from Minecraft 1.5.2. Note that the Java 8 one is identical to the one you generated with Minecraft 13w02a, and the Java 11 one is identical to the one you generated with MC-TextureGen. It looks like newer versions of Java changed the way that fonts render on Windows, which is worth documenting.

With note to your recent comment: I agree that I should make a new category for this type of image. I think the first texture I generated was generated with Java 16. Here's a few for the record (all generated on MacOS 10.14.6):

muzikbike commented 2 years ago

That is relieving.

muzikbike commented 2 years ago

Worryingly, WinMerge points out some extremely, extremely subtle differences between your generated Retina antialiased texture and the one listed in https://bugs.mojang.com/browse/MC-7208 - with the differences being a single number (for example 194, 194, 194 instead of 193, 193, 193). I'll document these separately for now and just hope the program is still working as expected and that maybe mspaint introduced weirdness like this while cropping or something.

NeRdTheNed commented 2 years ago

Worryingly, WinMerge points out some extremely, extremely subtle differences between your generated Retina antialiased texture and the one listed in bugs.mojang.com/browse/MC-7208 - with the differences being a single number (for example 194, 194, 194 instead of 193, 193, 193). I'll document these separately for now and just hope the program is still working as expected and that maybe mspaint introduced weirdness like this while cropping or something.

...@muzikbike you're entirely right, that's really subtle. Here's the output of ImageMagick's -compare command (with -metric AE):

imagemagick_compare_ae

It's currently 12:30 at night in my timezone, so I'll have to look at this more tomorrow, but thank you for finding this. I hope it's just a Java version difference (the bug report says "Powermac 10.5.8", suggesting Apple Java 5 on a G4 / G5).

muzikbike commented 2 years ago

Just to make sure, can you send the terrain atlases generated by those versions as well?

I don't have any atlases to compare any of the other smoothed textures you posted, so I can't be sure on that front.

I also found some stuff through google images that might imply some sort of setting influences these, or that it might be an OS version difference again:

NeRdTheNed commented 2 years ago

Just to make sure, can you send the terrain atlases generated by those versions as well?

I don't have any atlases to compare any of the other smoothed textures you posted, so I can't be sure on that front.

I also found some stuff through google images that might imply some sort of setting influences these, or that it might be an OS version difference again:

@muzikbike Here's the texture atlases generated with Java 6 (Apple legacy Java runtime 1.6.0_65-b14-468) on MacOS 10.14.6: debug stitched_items debug stitched_terrain

Here's the cropped "missing texture" texture: item-0

This actually seems to match the texture generated with MC-TextureGen perfectly, meaning that it appears to be accurate. Tomorrow I'll boot up an old iMac G4 to see if I can generate the same texture that the bug report had.

NeRdTheNed commented 2 years ago

I'll also check to see if I can influence anything with font smoothing settings. Different versions of MacOS have various amounts of control over text anti aliasing settings. I have it turned off right now. I remember testing to see if it had any influence on the output textures, which it did not, but I did not test many versions of Java with it.

Screen Shot 2021-09-20 at 1 03 40 am

NeRdTheNed commented 2 years ago

@muzikbike On a whim, I tried ticking "use font smoothing" with Java 6 (Apple legacy Java runtime 1.6.0_65-b14-468) on MacOS 10.14.6, and it did actually influence the generated texture (uses polychromatic smoothing instead of monochromatic smoothing)!

Texture atlases from 1.5.2: debug stitched_items debug stitched_terrain

Cropped: item-0

MC-TextureGen: Missing_Texture_Java_b1_4_to_13w01b Missing_Texture_Java_13w02a_to_13w17a

The texture generated by MC-TextureGen is an exact match to the one generated by Minecraft 1.5.2.

As it's currently 1:30 in the morning, I'll probably not reply to any further messages until I get some sleep.

NeRdTheNed commented 2 years ago

I've tried comparing these generated textures with the ones from MC-7267, and they don't match.

Output of ImageMagick -compare command (with -metric AE): diff

I think this might caused by differences in the font smoothing on different types of screens. RenderingHints defines many types of font anti aliasing, all of which may produce different results. I might add a command line switch to generate a texture for each type of font anti aliasing.

NeRdTheNed commented 2 years ago

@muzikbike Here's some results for Java 1.6.0_65 on MacOS 10.6.8, running on an Intel iMac.

Command: java -jar MCTextureGenerator.jar -platformTextures true Notes: standard texture generation Missing_Texture_Java_b1_4_to_13w01b Missing_Texture_Java_13w02a_to_13w17a

Command: java -Dawt.useSystemAAFontSettings=on -Dapple.awt.textantialiasing=on -jar MCTextureGenerator.jar -platformTextures true Notes: -Dawt.useSystemAAFontSettings=on -Dapple.awt.textantialiasing=on are passed to force text anti aliasing to be on. Missing_Texture_Java_b1_4_to_13w01b Missing_Texture_Java_13w02a_to_13w17a

Command: java -Dawt.useSystemAAFontSettings=on -Dapple.awt.textantialiasing=on -Dapple.awt.graphics.UseQuartz=true -jar MCTextureGenerator.jar -platformTextures true Notes: same as above, but -Dapple.awt.graphics.UseQuartz=true is passed to simulate how Java 5 might render the text. apple.awt.graphics.UseQuartz would normally be set to "true" for Java 5 and below. Missing_Texture_Java_b1_4_to_13w01b Missing_Texture_Java_13w02a_to_13w17a

The texture generated when apple.awt.graphics.UseQuartz is set to "true" is unique, making it the third unique variation of a polychromatic text texture generated by an Apple Java runtime. Given that there's so much variation in these textures, I think it's likely that MC-TextureGen is accurate, and there's just a lot of variations on this texture. I'll keep this issue open for now, as I may have failed to cover some edge cases.

NeRdTheNed commented 2 years ago

Worryingly, WinMerge points out some extremely, extremely subtle differences between your generated Retina antialiased texture and the one listed in bugs.mojang.com/browse/MC-7208 - with the differences being a single number (for example 194, 194, 194 instead of 193, 193, 193). I'll document these separately for now and just hope the program is still working as expected and that maybe mspaint introduced weirdness like this while cropping or something.

@muzikbike Here's an exact match for MC-7208:

I'll see if I can replicate this in more natural conditions.

muzikbike commented 2 years ago

@muzikbike Here's an exact match for MC-7208:

  • MC-TextureGen on an iMac G4, running MacOS 10.3.9, on Java 4, with -Dawt.useSystemAAFontSettings=on -Dapple.awt.textantialiasing=on Missing_Texture_Java_13w02a_to_13w17a
  • MC-7208 unstiched-0

I'll see if I can replicate this in more natural conditions.

Getting back into documenting these. Can you provide a b1.4-13w01b version as well?

muzikbike commented 10 months ago

Probably late on relaying this information, but there was a particularly confusing case last August by a user who no longer appears to be a member of the Omniarchive discord server: IMG_7267

On macOS 12.3.0 using java 1.8.0_74 (64 bit), it appears that monochromatic smoothing is employed, but then all pixels that aren't pure white are immediately set to pure black. The provided texture atlases are reflective of this fact: IMG_7270 IMG_7271

However, the generated texture files from MC-TextureGen (assuming the Java version used is the same) didn't match at all: https://discord.com/channels/361634042317111296/361634042317111299/1008511940357791744

This is an especially oddball case - not sure if you'd be able to figure out what went on here.

Lassebq commented 10 months ago

I'm pretty sure if we included linux (unless you already do) the text on missing texture could be controlled in almost every possible way, so I don't think it's even worth covering all cases and simply generate it same way minecraft does? Also there may have been user error when checking for inconsistency between generated in-game texture and mctexturegen one, such as java on %PATH% being a different one from launching the game.

Lassebq commented 10 months ago

Oh yeah, and considering this project is also made in java, an accurate port should give the same results. No edge cases

NeRdTheNed commented 10 months ago

Documenting some Discord discussions for future reference:

Getting back into documenting these. Can you provide a b1.4-13w01b version as well?

My iMac G4 has sadly died, so I was unable to provide those textures.

Probably late on relaying this information, but there was a particularly confusing case last August by a user who no longer appears to be a member of the Omniarchive discord server:

The in-game textures were likely generated with the JRE currently bundled with Minecraft on macOS. Here are the results from using it to generate the text-based missing textures (macOS 12.7, M1):

Missing_Texture_Java_b1_4_to_13w01b

Missing_Texture_Java_13w02a_to_13w17a

It's possible the user was using a different version of Java to run MC-TextureGen, but it would be good to investigate any possible inaccuracies.

NeRdTheNed commented 10 months ago

Oh yeah, and considering this project is also made in java, an accurate port should give the same results. No edge cases

The differences caused by this particular generator are due to how each version of Java handles text rendering. The texture is generated by calls to Graphics2D.drawString, without a specific font. This may cause differences based on the default font Java uses on each version and operating system, as well as differences from the used text rendering library (may use platform native font rendering, different versions of libraries etc), as well as AWT state (i.e. with the legacy Apple JRE) and operating system state (different anti-aliasing font settings) etc.