Creating a Maze with Blender (or at least try...)

I started drafting a Maze with Blender to get some visible progress. This is related to the concept document I drafted couple of days before (please see previous blog text).

The elements needed for a board are quite simple: the bottom plate, some walls to implement a maze, and of course holes to increase the difficulty level. There are couple of ways to do this job, but some of them are more feasible than others.

My first idea was to create basic building blocks from cube. The purpose was to design set of blocks and build game board from them. I calculated, that I would need total of 10 different blocks to implement a maze. Here's a concept picture of needed blocks:


So there are hole and non-hole versions for every block.

Creating a cube in Blender is an easy task: just select Add->Mesh->Cube, and that's it.

I moved my cube to the origo (0,0,0), resized it a bit on z-axis, and started to think how to create a hole to it. I have used Blender for couple of animation projects, but never had need to make holes to the objects. So this task required some googling, and I found one method to create nice holes to the cube:
  1. Create a cube
  2. Create cylinder object. Resize and place it so that is goes through the two opposite faces of the cube (see left picture below)
  3. Select the Cube, and then click "Object Modifiers" (wrench icon in Properties windows), then "Add modifier", and select "Boolean"
  4. Select "Difference" from the Operation pull-down menu, and add Cylinder to the "Object" field
  5. Click "Apply", delete Cylinder, and voila! You have created a hole through your cube. 

Cube and cylinder
Cylinder removed after applying'
Boolean modifier.














The resulting cube seemed good enough for my purposes, so I removed the top side face and the tube going through the cube. Next step was to duplicate cube and remove faces step-by-step so that I was able to get all the blocks with holes, as described in the concept picture. I had also create another cube for the blocks without holes, and duplicated all required versions from that (removed faces as needed).

After I had all blocks in place, I started to build a game board from them. The first version looked like this:

Looked good at this point, but unfortunately it had some serious problems when imported to Unity3D: Plenty of faces were missing, and after some "googling" I understood that this behavior was related how "normals" were calculated in different tools.

I tried to re-calculate  normals in Blender (ctrl+n), inverted them, and did couple of other tricks, but I did not succeed to create a version that worked without problems in Unity.

The maze is built from the "root" blocks by duplicating and rotating them, and the normals of each sidewall are what they happen to be. My guess is that Unity is rendering only the "positive" faces (or outsides), and all "negative" faces (or insides) are left transparent. Blender is rendering meshes different way, and these problems are not visible there. Of course I could try to manually fix normal directions for each wall in Blender, but I found that too difficult task for me.

Anyways, I found this approach to be unusable for my purposes, and I decided to create the board a bit different way. So I did not invest more time for resolving this any longer. I will continue with different approach. This time I will investigate how it works with Unity3D before I spend hours for building the whole board.

I think I have learned something from this excercise, so it was not a waste of time. :)

Comments

Popular posts from this blog

Unity3D mirror using camera and RenderTexture

Unity3D: Convert Seconds to hh:mm:ss Format

Construct 2: if-then-elseif-else statement