Randomly Generated Minecraft Textures
by Adam Gerhant in Craft > Digital Graphics
187 Views, 0 Favorites, 0 Comments
Randomly Generated Minecraft Textures
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
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
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
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
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.