I've come to show you what I'm doing, to have your opinion or even feedback. Voxel terrains seem quite mainstream these days, so about 6 months ago I began creating my own, curious about what I could achieve. Like many people I was inspired my Minecraft and thus setup some goals I wanted to achieve:
- smooth surface (not huge pixel looking cubes);
- dynamically editable (diggable);
- "decent" view distance;
- network streaming;
Almost needless to say that I went for marching cubes, implementing the GPU based technique described in GPU Gems 3 (the screenshots were good looking). I obviously made a LOD system. Each level being quite big (128^3 voxels for now), I split them up into smaller regions for generation speed purposes. The terrain geometry is generated as we move around, each slice of regions in the moving direction is computed when needed. Here come some screenshots:
It's still work in progress but I'm quite happy with the results so far. No fancy rendering effects here.
I'm currently working on the networking part. The server stores the voxels into an octree were nodes are chunks of like 32^3 voxels. Nodes are currently stored as in in the hard drive; though I didn't run any serious test for now storage will most likely become an issue. Fortunately this kind of data seems to compress quite well (each voxel is one byte long... for now). However I can't go around compressing/decompressing files on the fly as needed, especially if several clients are modifiying the terrain at the same time, which involves setting up some sort of cache system, which brings synchronization issues. Since I'm working on this I am considering many solutions, ideas are of course most welcome.
There are a couple of things I'd like to do/try in the future, if you have ever done such stuff I'd be glad to know :)
- (very?) long-range ambient occlusion, using each LOD well I believe giant cave could be nicely darkened;
- conservative LOD: currently each level of detail erodes the terrain and small parts of it disappear. I was thinking of applying some sort of "max" filter when computing the LODs, and then shrink the surface alongside its normal to keep the terrain from getting fat. It would keep any piece of floating terrain, but fill holes very quickly;
- I wonder what it'd be like to grow trees, making them match the surface of the terrain, which would add realism;
- different materials (I've seen it being done in voxelform);
- growing grass; I guess that would require quite a big amount of computing power, as it would need to keep in memory and regularly update areas where grass can grow;
- CPU terrain geometry generation?
- water... ?
The project is open-source and part of my 3D engine, you can find more screenshots, some videos and of course the git repositories on my website: http://www.scengine.org/
You might however not be able to run the terrain demo since the example sources are not always up-to-date (especially when I'm working on them).
Thanks!