sp614x / optifine

1.8k stars 418 forks source link

[Suggestion] Use 1 large texture image and have the game use it for method repeat #1309

Closed MisterQuiggly closed 6 years ago

MisterQuiggly commented 6 years ago

What it is

This idea for this is being able to eliminate the monotonous task of taking the texture you want, which are presumably large, and having to break down the image into many files of small sizes like you currently have to. process This is an example of the process I use to break down an image into its many files required in order to repeat it in the game. In this example, I'm using a 1024x1024 texture (which is much much bigger than most files I would normally use) and breaking it down into 16x16 textures. The result of this would be 4096 individual image files to make up this texture in the game. With the method I'm proposing, there would only be 1 individual image file.

How the file looks

An example if it was using the large 1024x1024 image I referenced above:

method=repeat matchTiles=grass_top resolution=16 (This is the size of the individual block texture you want, like 16x16m 32x32, 64x64) width=64 height=64 tiles=0

Dont know if this would be required, but maybe in the properties file there could be another line like:

textureSize=x (the image has to be square for Minecraft to recognize it. X represents the width and height of the image, in this case, 1024)

Basic math has to be done to figure out the width and the height (x/y where x represents the image size and y represents the block resolution you want).

Here are some examples of using the same 1024x1024 file, but with different resolutions:

method=repeat matchTiles=grass_top resolution=32 width=32 height=32 tiles=0

method=repeat matchTiles=grass_top resolution=64 width=16 height=16 tiles=0

This would save an astronomical amount of time if this was implemented.

sp614x commented 6 years ago

This can also be done with a small GIMP or PS script.

MisterQuiggly commented 6 years ago

I use Gimp to do all my textures. That screenshot is Gimp. I use what it calls "guides" (as shown above) which puts all the blue lines around it, then a feature called guillotine to take each part divided by the guide and make a separate image out of it.

Separating the image into all of its little 16x16 counterparts is easy. The part that takes forever is the exporting and naming of each file. The standard size I use for repeat is 128x128, meaning it creates an 8x8 guide, which each being 16x16 pixels. The end result for that is 64 files named 0 through 63. Assuming I can perfectly export all of those without making a single naming mistake, or accidentally not exporting 1 of the 64 images, it takes around 5 minutes.

So setting up the guides and guillotining it is the easy part. I don't know how to write scripts, but the script that would be needed would be one that can name each file then export it. All of this is possible (except the script) just time-consuming. The larger the texture, the longer it takes. I don't know if its possible for you to be able to make it so it can use a single image and break it up itself, but if so it would be extremely useful and save lots of time. I have probably spent hours on the repeat textures alone for a simple pack I'm making, though the end result is worth it.

sp614x commented 6 years ago

There are many ways to automate image splitting, for example: https://imagesplitter.net/ http://pinetools.com/split-image https://www.imgonline.com.ua/eng/cut-photo-into-pieces.php http://www.pictools.net/split/ ...

ImageMagick can also do the trick: http://www.imagemagick.org/discourse-server/viewtopic.php?t=15771 http://www.fmwconcepts.com/imagemagick/tidbits/image.php#crop2

sp614x commented 6 years ago

Generally OptiFine does not modify the resource pack textures and the splitting would be best handled by an external tool.

MisterQuiggly commented 6 years ago

Do you have any idea why this isn't working exactly? This isn't a full resource pack just the one CTM folder.

Edited to remove link so people don't steal my work.

sp614x commented 6 years ago

Currently width and height for method "repeat" are limited to 16. When the limit is increased it works:

image

MisterQuiggly commented 6 years ago

Oh that looks great! Will you be increasing the limit? Or allow us to define a limit in the properties file, default 16?

sp614x commented 6 years ago

The limit would be increased or removed in next preview.

MisterQuiggly commented 6 years ago

You have made me a happy man. Thank you.

sp614x commented 6 years ago

OptiFine 1.12.2_HD_U_D2