Randomly Generated Minecraft Textures

by Adam Gerhant in Craft > Digital Graphics

187 Views, 0 Favorites, 0 Comments

Randomly Generated Minecraft Textures

FHNWW83KX39H6D2.png
FN2405ZKX39H2MS.png

For this project I decided to make a script that randomly generates textures for Minecraft ore blocks. The main reason I did this is that Minecraft can get stale because everything looks the same every time, so loading a new world with ores you have never seen before can be a good way to keep the game fresh.

Supplies

For this project all that is needed is python and a couple libraries.

Generating Randomness

FNY8SY5KX39H3J8.png
FCV322WKX39H3J9.png
FQ7UACOKX39H3JA.png

In order to have random textures, it is important to have a way of generating structured random noise. The reason for this is that pure randomness would be very chaotic and look like white noise. In order to achieve this, I used an image to store Perlin noise data. Perlin noise is great for this application because it forms "smooth" randomness. I then opened the images with the Pillow library, and stored them as a variable. However, since I am using the same image, I would get the same texture every time. In order to fix this, I use a larger image file and sample a random area of it.

Generating Texture Data

F3GF87LKX39H3PC.png
FJLS3H1KX39H3PE.png

Once I have 2 Perlin noise sample, one with more detail than the other, I blend the 2 images together to form a single gray scale image. This is what will be used to create the texture.

Overlaying Texture Data Onto Stone Block

F6IDP2UKX39H5L6.png
FHQT1HKKX39H5PP.png
F5HUNHXKX39H5Q5.png

Once I have the texture data, it is important to color and place the texture onto the base layer, which is the stone block texture. In order to do this, I use a complex algorithm which uses many random variables, and loops over every pixel in the texture. If the pixel is above the threshold value, it is colored, and replaces the corresponding stone pixel. If not, then the stone pixel is not changed.


Conclusion

FWD0SIRKX39H79Y.png

In conclusion, I am very pleased with the results of this project. What I find most interesting is the wide variety of types of ore textures. Some textures are very pixely, some have more blobs, and some are a combination of both.