You can get Voxel Farm now. For more information click here.

Saturday, July 4, 2015

Export your creations

We just completed a new iteration on the FBX export feature. This new version is able to bake textures along with the geometry. Check it out in this video:

The feature seems rather simple to the user, however there are massive levels of trickery going on under the hood.

When you look at a Voxel Farm scene  a lot of what you see is computed in realtime. The texturing of individual pixels happens in the GPU where the different attributes that make each voxel material are evaluated on the fly. If you are exporting to a static medium, like an FBX file, you cannot have any dynamic elements computed on the fly. We had no choice but to bake a texture for each mesh fragment.

The first step is to unwrap the geometry and make it flat so it fits a square 2D surface. Here we compute UV coordinates for each triangle. The challenge is how to fit all triangles in a square while minimizing wasted space and any sort of texture distortion.

Here is an example of how a terrain chunk is unwrapped into a collection of triangles carefully packed into a square:

The image also shows that different texture channels like diffuse and normal can then be written into the final images. That is the second and last step, but there is an interesting twist here.

Since we are creating a texture for the mesh anyway, it would be a good opportunity to include features not present in the geometry at the current level of detail. For instance, consider these tree stumps that are rendered using geometry at the highest level of detail:

Each subsequent level of detail will have less resolution. If we go ahead five levels, the geometric resolution won't be fine enough for these stumps to register. Wherever there was a stump, we may get now just a section of a much larger triangle.

Now, for the FBX export we are allocating unique texture space for these triangles. At this level of detail the texture resolution may still be enough for the stumps to register. So instead of evaluating the texture for the low resolution geometry, we project a higher resolution model of the same space into the low detail geometry. Here you can see the results:

Note how a single triangle can contain the projected image of a tree stump.

This process is still very CPU intensive as we need to compute higher resolution versions for the low resolution cells. This iteration was mostly about getting the feature working and available for users. We will be optimizing this in the near future.

The algorithms used here are included in the SDK and engine source code. This sort of technique is called "Detail Transfer" or "Detail Recovery". It is also the cornerstone for a much better looking LOD system, as very rich voxel/procedural content can be captured and projected on top of fairly simple geometry.


  1. Among other things, awesome job sorting the triangles into a single texture!

  2. I was playing around in voxel farm and figured out how to place individual prefab objects, and I must say the scaling options on them are really cool. One thing I haven't figured out though is how to define orientation or position (snap works nice to make things level but when I unsnap the objects get embedded into the ground)

    1. How do you place the prefabs? Brush or select tool?

    2. I was using the brush tool, I'll try to figure out the select tool placement tonight.

  3. Hello !

    This is Absolutely completely Amazing ! Thanks so much for doing it !!
    Especially for us that we are content creators ..

    On the content creators topic ...

    IS IT POSSIBLE ? To have ( the inverse )

    -» Better FBX Import With TExtures with Uvs Baked Directly From Fbx to voxel ...

    -» Maybe this same technique could be used inversely to Import fbx with 1 or many textures
    ( Then automatically create a voxel with texture Baked from the fbx to voxel )

    - » A Alternative would be also to Allow us Import raw Fbx Models ( non voxels ) With our own lods ... And Manipulate position and scatter around in the world ... Then also Import all that ( Voxels and polygons from Mixed mashed and scatered toguether from voxelfarm ) in the Unity/unreal plugins ... Like in the future ...

    Imagine that we want to animate a dragon flying around ...
    Or that we would like to import Speedtrees or Plantfactory meshes
    Or anything we have to serve as ecosystems ...

    You See Voxels are amazing for some Applications .. but there are sometimes nothing like just import our own polygon with uv meshes as any other 3d engine ...

    Making voxel farm just manipulate and scatter voxels And juts work with voxels
    Makes it Limited if we want More AAA Alike looks .

    Merging both would be a better Future . And make this engine even more powerful.

    Its just 1 happy customer wish and desire ...
    But i believe there will be more happy customers if you can do that ^^

    Thanks so much for bringuing us the future today Studio.

    1. Yes we are doing exactly that with the new UV mapped voxels. Not sure if you saw this (still work in progress):

      Once this is working you will still have some requirements imposed on the meshes you bring into the voxel world. You will have to make sure they are properly closed otherwise they won't voxelize well. And as usual you will have to be aware of the voxel density to avoid aliasing.

  4. Can the "Creator" license export an FBX with baked texture? I would be using solely for creating terrain to use in iClone, a realtime animation program, and have no need beyond the studio tool.