Eden – MagicaVoxel Integration

I have been meaning to experiment with the MagicaVoxel program in relation to rendering worlds in Eden. I scoured the internet looking for a simple little library in C# to make generating MagicaVoxel .vox files quick and easy and couldn’t find anything. There is a plethora of importers to other programs so one can create models in MagicaVoxel and then import them into various game engines, modeling applications etc, but I couldn’t find anything that generated models in MagicaVoxel programmatically, so I just wrote my own little library to do just that! It’s freely available over on Github if you are interested.

For reference the following sample code will generate a .vox file of a simple 3x3x3 cube of random different voxel colors (given the chosen palette which is default currently) with a lattice structure:

using System;
using System.Collections.Generic;
using CapitalGStudios.Exporters;

Random oRandom = new Random();
List<MagicaVoxelData> oVoxels = new List<MagicaVoxelData>();

for (int iX = 0; iX < 3; iX++)
   for (int iY = 0; iY < 3; iY++)
      for (int iZ = 0; iZ < 3; iZ++)
         if (iZ == 1 && (iX == 1 || iY == 1))
         else if (iX == 1 && iY == 1)

         oVoxels.Add(new MagicaVoxelData(iX, iY, iZ, oRandom.Next(0, 256)));

MagicaVoxel oMagicaVoxel = new MagicaVoxel();
oMagicaVoxel.Export("3x3x3.vox", 3, 3, 3, oVoxels);
3x3x3 Lattice Type Structure

I’ve since integrated a simple command into Eden that automatically exports the terrain information into the .vox format required by MagicaVoxel and was rewarded with a 3D representation of worlds within Eden!

Never fear, Eden at its graphical heart is a crunchy pixelated 2D game, by design. I just thought it would be cool for players to be able to export their little worlds in Eden in such a way that they can visualize it in the three dimensions the game is accurately simulating. It was also a nice little diversion to work on something a little outside of Eden but still related in a way 🙂

Disclaimer: The image below does NOT represent the visuals of Eden, it is an image produced using MagicaVoxel to render the world information within Eden. I have no association with MagicaVoxel, I just think it’s an awesome voxel editor/renderer and that @Ephtracy fella has made a wonderful application 🙂

The two images below are not correlated, just samples of a random world in Eden, one exported to render in MagicaVoxel, the other as it is rendered within Eden.

A World in Eden as Rendered in MagicaVoxel
A World in Eden as Rendered in Eden

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