Rendering Minecraft in Blender

I’ve been having an on and off love affair with Blender for three years now. While it’s true that the interface is bordering on user-hostile once you begin to understand the Blender way of doing things it is an incredibly capable piece of software.

Recently I stumbled upon Mineways, a free, open-source program which allows you to export sections of your Minecraft worlds for rendering or 3D printing. Being quite a fan of Minecraft (my wife and I had our Minecraft avatars on our wedding cake) I thought I’d have a play with it and see what I could make.

I did it Mineways

The Mineways program itself is incredibly easy to use. Open up a world file, chose the maximum height and depth you would like in the final scene, ctrl-click (right-click) and drag over the section you would like to export and then export an OBJ file for rendering.

Mineways

Once Mineways has finished exporting you’ll be left with several files:

  • An OBJ file which we’ll open in Blender
  • An MTL file which specifies the materials for the model
  • Three PNGs of Minecraft textures in RGB, RGBA and Alpha versions

It’s probably good housekeeping to put all of those files into a folder to keep everything organised and then we’re ready to get into Blender.

Will it blend?

So first up you’ll need to download and install Blender (the current version is 2.74 at the time of writing). Next if you are completely unfamiliar with the software I would recommend you go and make a mug to get up to speed with navigating the interface. You may also find that using a mouse makes it easier to navigate although it is possible with a multitouch trackpad (which is how I use it).

Now that you have Blender installed and you know your way around it a little lets get started. Create a new file in Blender, you should have a scene with a cube in the middle of it. Right click on the cube to select it, press “x” on the keyboard and click on the delete option that appears under your cursor. This should leave you with an empty scene ready to import your model. To import the OBJ file select File > Import > Wavefront (.obj) and then navigate to the OBJ file created by Mineways.

You should now see your model in all it’s greyish beauty. To see a textured preview change the viewport shading mode to texture by pressing “alt+z” (option+z), to switch back press “z” to go to Wireframe mode and “z” again to get back to Solid mode.

Blender Viewport Shading Modes

Now to see how it renders we need to set up at least one light and one camera. Fortunately the default Blender scene contains a camera and a sun lamp so you should be nearly ready to go. Adjust your view by rotating, panning and zooming until you have a good view of the model. Then from the View menu at the bottom left of the panel you’re working in select View > Align View > Align Active Camera to View.

Now we’re ready for our first render. Select the camera icon from the panel on the right to access the render settings. Set your resolution in the panel and then press the Render button. The output may look a little like this.

Blender internal renderer

My render came out particularly strangely as the world file I was working from came from a modded version of minecraft (ATlauncher). Mineways is only designed for “vanilla” (non-modified) minecraft worlds so it converts blocks it doesn’t recognise into bedrock. In this case it also got confused by the variety of trees available and made some trunks out of coal ore and some leaf blocks into wood blocks.

It’s fair to say that I was a little disappointed with this render but worry not things will get better. Blender has two built in renderers – the code that computes how the final image should look. Currently we are using Blender Render which is the original renderer for Blender and our other option is to use Cycles. The differences between them are many but essentially it boils down to Cycles being based on the physical world and therefore generally creating more realistic looking renders.

A new Cycle

There are definitely things we could do to improve the output in Blender Render but I’m going to suggest we jump ship to Cycles and get this render looking nice and smooth. Unfortunately however you can’t just switch to Cycles and carry on rendering. You have to recreate all the textures in your scene using nodes.

For most objects you just need to create a diffuse shader that uses an image texture as an input for the colour and then assign filename-RGBA.png as the texture. You can either do this in the materials tab on the right or in the node editor.

minecraft-diffuse-texture-nodes-cycles

For objects that have transparency (leaves, flowers, grass, etc.) you’ll need to add a mix shader between the diffuse shader and the material output. Then you’ll need to connect a transparent shader to the first shader input of the mix shader and control its factor with filename-alpha.png.

minecraft-texture-nodes-cycles

Having made those changes you should get something like this.

Full colour Minecraft render

It takes a while to get all the materials set up and the render can take a long time (this image took about seven hours with a thousand samples) but the results speak for themselves.

If you want to increase the “realism” you can experiment with lighting and add emission shaders to textures that should be light sources. In the image below the environment is set to black, the lava is a mix of diffuse and emission shaders and there is a dim moonlight from above.

Lava Emission Shader in Cycles

Switching to cycles won’t solve any issues with incorrect or missing textures though, so for now it’s probably best to stick to vanilla minecraft worlds. I’d really like to make some nice renders of the particle accelerators and nuclear power stations that my friends and I have built in the previous games so it may become the subject of a future post.

Beyond Minecraft

If you want to experiment further you can make your own textures and assign them to whichever objects you like. I tried another version using a mix shader that combined diffuse and glossy shaders to produce a material similar to a hard plastic.

Hard white plastic cycles nodes

I then added a plane beneath the minecraft model, scaled it so it expanded beyond the view of the camera and assigned the same texture to it. I also used a plane out of shot to the right with an emission shader to simulate the light of a soft box. The result is the bright and clean renders below.

minecraft-white-render

Close up of Mix shader in Cycles

A quick bonus

The day after I posted this I found a YouTube video that explains how to render minecraft items in Blender. It’s really quick and easy to follow, best of all you can use it with cycles by creating a diffuse shader with the colour input set to the image.

Minecraft Iron Sword

Tekkit Classic with Minecraft 1.6.2

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

Following on from my previous post I wanted to write a little more about the issues I found trying to get all of the Tekkit Classic mods working with Minecraft 1.6.2.

Having discussed everyone’s requirements, my friends and I agreed that we wanted all the features of Tekkit Classic with the additions of Stargate, Twilight Forest, Archimedes Ships, Useful Foods, Treecapitator and a few others. I read a lot of guides and figured out how to set up a custom Forge server for Minecraft 1.6.2.

Now we can install any mods we want but there are some caveats. Firstly not all mods work with Minecraft 1.6.2 and secondly not all mods work with each other. This is where we hit the first problem, Tekkit Classic is built on Minecraft 1.2.5 so all of the mods that come with it are designed for that. Some of them have been updated to 1.6.2 but unfortunately not all.

Mod Name 1.6.2 Download
Balkon’s Weapon Mod Yes Here
BuildCraft Yes Here
BuildCraft Additional Pipes No
ccSensors No  
ComputerCraft Yes Here
IC2 Charging Bench Yes Here
Dimensional Anchors Yes Here
Equivalent Exchange 2 No
Ender Storage Yes Here
Industrial Craft 2 Yes Here
IC2 Advanced Machines Yes Here
IC2 Compact Solars Yes Here
IC2 Nuclear Control Yes Here
Immibis Core Yes Here
Inventory Tweaks Yes Here
Iron Chests Yes Here
MAtmos Yes Here
Modular Force Field System Yes Here
Not Enough Items Yes Here
Nether Ores No  
Power Converters Yes Here
Railcraft Yes Here
Red Power No  
Rei’s Minimap Yes Here
Tube Stuff Yes Here
Wireless Redstone WR-CBE Yes Here

Of the modules missing the Additional Pipes for Buildcraft and the Sensors for ComputerCraft were no big deal as I don’t think any of us have ever used them.  Equivalent Exchange 2 not being available is a bigger problem as one of my friends is very keen on that mod.  EE3 is available for 1.6.2 but it is arguably not as good (or perhaps it’s just more balanced). Nether Ores are no big loss either as none of us really mine in the nether.

Red Power is an issue though as it includes so many features. There are some modders working on creating similar mods for 1.6.2, Immibis has RedLogic and I came across a few others.

Unfortunately I was unable to get RedLogic or Equivalent Exchange 3 to install with the other mods on my server.  I’m hoping there will be some updates that may resolve that in the near future as they make up a large chunk of the features of Tekkit Classic.

This is my final set of mods, including what I could from Tekkit Classic and the additional ones that we wanted.

  • Advanced Repulsion Systems 56.0.0
  • Advanced Machines 56.0.0
  • Arhimede’s Ships 1.6.2
  • BuildCraft 4.0.2
  • ChickenChunks 1.3.3.2
  • CodeChickenCore 0.9.0.5
  • ComputerCraft 1.5.6
  • Dimensional Anchor 56.0.1
  • Dyeable Beds 1.6.2
  • EnderStorage 1.4.2.2
  • Greg’s SG Craft Mod 1.6.2
  • Immibis Core 56.0.5
  • Immibis MicroBlocks 56.0.5
  • Industrial Craft 2
  • Infinitubes 56.0.1
  • Iron Chests 1.6.2
  • IC2 Charging Bench 1.90
  • Not Enough Items 1.6.1.3
  • Teleport Pipes Mod 1.6.2
  • Timber! 1.6.2
  • Twilight Forst 1.19.3
  • Useful Food 1.6.2
  • Weapon Mod

Building a Custom Forge Minecraft 1.6.2 Server

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

Having played through Tekkit Classic, Voltz, YogCraft and Tekkit my friends and I decided it was time for a custom mod pack. This of course meant that I had to figure out how to build it. After reading a bunch of tutorials of differing quality and reliability I was left under the impression that I would need to use a PC. Fortunately for us Mac users with Minecraft 1.6.2 and the new Forge installer this is not the case.

Installing Minecraft Server 1.6.2 and Forge

Head to the minecraft site and grab a copy of minecraft_server.1.6.2.jar. Make a folder to store your server and copy the jar into it. Double click to run the server and continue passed any warnings that may pop up. Once the server has finished loading type “Stop” in the console.

Now we need to install Forge so head over to their site and grab the latest installer. Download it to your desktop or anywhere else that isn’t your minecraft server folder. Double click to the launch the installer. Chose “Install Server” and then make sure it’s got the correct path to your server folder. Hit Ok. This seems to take ages, I have a 70mb connection and yet the bar still crawls along and stops repeatedly. After waiting a while you will probably receive an error like the one below:

Error downloading
These libraries failed to download. Try again.
org.scala-lang:scala-library:2.10.2,
org.scala-lang:scala-compiler:2.10.2

If this happens WontWorld on Youtube has got you covered. For me it only failed to download one of the libraries but his instructions fixed it.

Now you will need a launcher batch file so that you can configure how much RAM is assigned to the server at launch. Open up textedit (or similar), make sure you are in Plain Text (Format > Make Plain Text), then copy and paste the following code.

#!/bin/bash
cd "$(dirname "$0")"
exec java -Xmx4G -Xms4G -jar minecraftforge-universal-1.6.2-9.10.0.804.jar

This will assign 4Gb of RAM for your server but you can change it accordingly for your system. My server runs 24/7 on a Mac Mini with 8Gb of RAM that I use as HTPC as well so I leave half the RAM free for other applications.

Save the file as launch.command. Now you need to set permissions for the file so that it can be executed. Open terminal, navigate to your server folder by typing “cd” without the quotes, then a space, then drag and drop your server folder onto the terminal window. That should complete the command with the full path to your server folder. Hit return and then type the following code.

chmod a+x launcher.command

Excellent. Now quit terminal as it’s scary in there and we won’t need it anymore. Next double click on launcher.bat and your MinecraftForge server should start. This would be a good time to test that you can connect to your new server.

Installing Forge for your Minecraft Client

Before connecting to the server you’ll need to install forge but before you can so that you must run Minecraft once. You’ll need a copy of Minecraft 1.6.2 from the Downloads page. Install it as normal and then open it. Once you get to the screen with a button that says “Play” you can quit and then install Forge.

This is fairly simple, just run the Forge installer you downloaded earlier choose “Install Client” make sure that the installer has the right path to your minecraft install and hit OK. This is generally very quick and painless.

Now open Minecraft again, choose the new Forge profile at the bottom left and hit Play. In Minecraft click Multiplayer, then add your server and test that it works.

If you’ve got this far and everything is working then it’s time to move on to the fun bit.

Installing Mods into FML in Minecraft 1.6.2

So now that you have your list of mods, download them all into a working directory somewhere other than your server folder. When you download them be sure that your browser is not unzipping them, if it is you should be able to find the zips in the trash.  All of the mods will be either ZIP files or JAR files.

All that’s left to do now is install the mods by moving the mod file into the mods folder inside your server folder.  It would be nice if you could just drag them all in at once and it worked but that was not my experience.  I found that it was best to add one at a time and check I could still login. Remember that any mod installed on your server also needs to be installed on your client.

Some mods have different files for server and client but most are universal.  So add a mod to your server, start the server, add the mod to your client, start your client and join the server.  Sometimes after adding a mod to the server it will die horribly and throw a SEVERE error. If that happens read the log file, read the forums, check for dependencies and try again.

You may need to copy the contents of the server’s config folder to your client’s config folder if you encounter ID mismatches between client and server.

It would also be a good idea to make backups of your server every time you successfully install a mod. This may seem like overkill but I finished this project once and was happily playing online when I decided I should add one more mod.  It threw a severe error, removing the bad mod didn’t fix it neither did reinstalling the server and copying the last backup of mods. Moral of the story backup everything all the time.

In the end I managed to get the following mods installed and living happily side by side.

  • Advanced Repulsion Systems 56.0.0
  • Advanced Machines 56.0.0
  • Arhimede’s Ships 1.6.2
  • BuildCraft 4.0.2
  • ChickenChunks 1.3.3.2
  • CodeChickenCore 0.9.0.5
  • ComputerCraft 1.5.6
  • Dimensional Anchor 56.0.1
  • Dyeable Beds 1.6.2
  • EnderStorage 1.4.2.2
  • Greg’s SG Craft Mod 1.6.2
  • Immibis Core 56.0.5
  • Immibis MicroBlocks 56.0.5
  • Industrial Craft 2
  • Infinitubes 56.0.1
  • Iron Chests 1.6.2
  • IC2 Charging Bench 1.90
  • Not Enough Items 1.6.1.3
  • Teleport Pipes Mod 1.6.2
  • Timber! 1.6.2
  • Twilight Forst 1.19.3
  • Useful Food 1.6.2
  • Weapon Mod

Now it’s up to my friends to play test it and see if it breaks horribly.

YogCraft and Server Texture Packs

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

I have been running a private Minecraft server for myself and some friends for a while now.  We have been playing through a variety of Modpacks, starting with Tekkit then Voltz and yesterday we switched over to YogCraft.

On Minecraft servers you have the option to force users to download and automagically install a texture pack when they join.  I’ve never tried this before but I thought I’d give it a go as I was starting a new server.  The way it works is that you need a zip file containing the texture pack somewhere publicly accessible on the internet and you modify the server.properties file to tell it where to find it.  I tried this but immediately realised that there is a limit of 10Mb for texture packs served in this way and the one I had was 38Mb!

A little research showed me that there are some command line utilities to optimize PNG files which might help reduce the file size. A guy who knows a lot about PNGs has made them more user friendly by making a free drag and drop PNG optimiser called ImageOptim. I gave it the texture pack to chew on, 1200+ images that come to 40.7Mb before zipping, and left it to cook overnight.  I knew I was being overly optimistic seeing as I would need a 74% reduction overall to get it within the maximum allowed file size.

Additionally I found out that when you compress files on a Mac it includes all of the hidden system files (resource forks) in the archive. For a texture pack the system files are redundant and potentially increase the overall file size. Fortunately there are several applications available that allow you to create zip archives without the system files. I already use a free application called Keka to deal with archives and found that it offers this facility.

So after running all of the images through ImageOptim I was left with a folder weighing in at 32.1Mb.  I then compressed it at the highest setting with with Keka telling it to “exclude Mac resource forks” and was rewarded with a 29.9Mb file. For the sake of comparison using the built in Compress command in OS X created a 30.5Mb zip file so excluding the resource forks saved 0.6Mb.

The net result is a decrease in file size of a little over 21% which although significant is sadly shy of the 74% saving required. So I guess I’ll just email my friends a link to the zip and instructions on how to install texture packs for Minecraft.

For the sake of anyone arriving here from google the folder for texture packs in YogCraft on the Mac is: /Applications/YogCraft/minecraft/texturepacks