TMX map to 3d unity models via python and Blender…

by

Geek spend yesterday afternoon writing a quick prototype python script that takes as input a TMX tilemap from Tiled and turns it into a 3d OBJ file that Blender can import.  He decided that the TMX tilemap should be setup so that each layer is at a particular z value and he’s making voxels out of each “tile” with a fixed thickness, just as an initial test.  The script also makes a materials file out of the TMX file tile image file and applies that to the voxels.  Seems like a pretty cool idea to me.  Here’s his very first test picture (click to enlarge):

Script generated 3d model from TMX tilemap file and tiles, imported into Blender

I’m hoping he’ll write a tutorial on how to do it, but the basic idea is that he’s reading in the TMX tilemap file and parsing it one layer at a time, outputting the coordinates and materials references in OBJ file format as well as generating the appropriate materials file.  Relatively straight-forward, but not something I would have thought to do.

Update 1/14/2011 –

Geek played with this some more today and added support for hexagonal tile TMX tilemaps.  Here’s a first test image:

Hexagonal TMX tilemap conversion to 3d model first test

Update January 30, 2011 –

Geek’s been playing with this more over the last couple of weeks and he’s got support for using TMX tiles to indicate placement of 3d models instead of just expanding tiles into the third dimension.  A config file specifies what model file to use for each tile id.  First tests of that were trees, and today he’s added initial support for castles (battlements are tricky!).

All 3d models are just quick test models and textures likewise are whatever he could find for free on the net.  The underlying technology he’s created that takes the TMX file, config data, texture files and 3d models and converts them into an OBJ file with materials, textures and 3d expansion of the 2d TMX file should work with more “real” parts.

Here are a couple of images from Blender after importing the OBJ files his python code has generated from the TMX files:

3d tree model replacement test on extruded hexagonal tilemap

Test castle with battlements 3d model insertion into extruded 2d hexagonal TMX tilemap

Advertisements

4 Responses to “TMX map to 3d unity models via python and Blender…”

  1. ananasplit Says:

    This is awesome, someone know where we could download or get more informations about this program?

    • Dad Says:

      Thanks! Geek’s still messing with it and improving this. He told me that he’s got it mostly encapsulated in a python module / library that he plans to open source once he’s got it cleaned up a big.

  2. Kyle Says:

    Would love to learn more and get my hands on this! Really great concept.

    • Dad Says:

      Thanks! This script is still at the level of a research project and Geek’s been busy doing other stuff… I’ll encourage him to maybe polish it up a bit more and get it onto github so others can add features and help it evolve.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: