## Voxel based mesh generator

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Caphalor
Greenskin
Posts: 116
Joined: Tue Feb 06, 2007 8:54 pm
Location: Berlin, Germany
x 25

### Voxel based mesh generator

Hi,
vBaum is a voxel based generator for procedural geometry. vBaum stands for "voxel-Baum", which means "voxel-tree" in english. This primaly relates to the underlying data structure, but we also plan to generate tree meshes with it later. The core algorithms are written in C++ for maximum performance. It supports various geometric figures, splines, boolean operations, extrusion and more. We use the Ogre math classes for vectors and matrices. The created geometry can be exported in the .obj and .stl file formats using the marching cubes algorithm and smoothing. A python interface is provided that enables users to quickly construct arbitrary geometry. Let me give an example:

This was created with vBaum (notice the self intersection) and rendered in Ogre. It was created with the following python script:

Code: Select all

``````#!/bin/python
from vBaum import *
from math import *

scale = 5
splinePoints = [Vector3(0,5,0)*scale,
Vector3(3,4,20)*scale,
Vector3(10,5,25)*scale,
Vector3(20,15,15)*scale,
Vector3(25,15,0)*scale,
Vector3(5,5,0)*scale,
Vector3(-10,-10,5)*scale,
Vector3(-10,25,10)*scale,
Vector3(20,-5,10)*scale,
Vector3(16,5,-10)*scale]

spline = Spline(splinePoints, True)		#create a closed spline from the points

knot = spline.extrude(Sphere(20))	#this will thicken the spline, creating a torus knot
knot.exportAsObj("knot", 50)	#file will be names knot.obj and a smooth with 50 iterations will be applied
``````
The next example is a bit more complex but the python script still has less than 80 lines. The mesh was rendered with Blender:

The next example shows that vBaum can also be used to generate less abstract objects. It was rendered using Ogre:

I know that this project is not directly related to Ogre but I provided screenshots rendered with Ogre so I hope it is ok to post here. In addition to that we use the Ogre math classes (Vector and matrix) and I think that it could be useful for some Ogre users. If you create something cool using vBaum please post some screenshots!

Usage: For windows 64 bit users we provide a precompiled binary along with some example scripts, in this case you only need python 3 to get started. If you want to build vBaum from source you need boost (because of boost::python) and the corresponding python version. vBaum was developed, compiled and tested under both windows and linux. Side note: The C++ implementation was developed by w0rm and me in only one week of coding fun, so you will not find many commentaries. You can find some background information here.

Known issues:
• Spline creation sometimes leads to an endless loop. However this problem occured rarely, we are looking into it. Our provided example scripts should run fine.
• Memory consumption: Creating large geometry can lead to memory and performance problems. We spent a lot of time optimising it, but it is still not perfect.
Last edited by Caphalor on Mon Oct 08, 2012 11:34 am, edited 3 times in total.

Generated with vBaum - voxel based procedural geometry generator with python interface.
PhilipLB
Posts: 550
Joined: Thu Jun 04, 2009 5:07 pm
Location: Berlin
x 108

### Re: vBaum - voxel based mesh generator

As you say, you use voxels, how are they stored? Do you generate some kind of scalar density field?
Google Summer of Code 2012 Student
Topic: "Volume Rendering with LOD aimed at terrain"
Mentor: Mattan Furst

Volume GFX, accepting donations.
drwbns
Orc Shaman
Posts: 782
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

### Re: vBaum - voxel based mesh generator

I could definately see a lot of uses for this. Awesome work
Caphalor
Greenskin
Posts: 116
Joined: Tue Feb 06, 2007 8:54 pm
Location: Berlin, Germany
x 25

### Re: vBaum - voxel based mesh generator

@PhilipLB:
Hi,
first let me clarify: We do not render voxels, we only use them internally and convert them to a triangle representation using the marching cubes algorithm in the end and write a .obj or .stl file. It is not suitable or intended for realtime rendering/generation, however the resulting meshes could be used in projects using Ogre.
The voxels are stored using an Octree. We only use integer coordinates and the coordinates are not stored explicitly for each voxel, they are determinded by the root node and the structure of the tree. However w0rm did the research and came up with the whole project idea so probably he should answer this question in detail. He wrote an article about basic concepts in our wiki here.

@drwbns:
Thank you!

Generated with vBaum - voxel based procedural geometry generator with python interface.