Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Modifying large quantities of voxels
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=23&t=646
Page 1 of 1

Author:  gus3000 [ Fri Jul 24, 2015 11:25 am ]
Post subject:  Modifying large quantities of voxels

Hi !

I'm currently working on a project whose goal is to model a human being in real-time with voxels.

The main difficulty is to keep a constant fluidity : it must run at 60 fps.
The size of the region is variable and up to 128 vox^3.

The cubiquity engine runs super smoothly once the voxels are loaded, but I can't manage to quickly modify the model : the only mean I see is to use the SetVoxel method. According to my tests, it takes approx. 200 ms to modify a 64^3 environment, and 1.6 seconds for a 128^3 one (to achieve the 60 fps thing, it must not take more than 16 ms :x )

I saw the C# code uses a C++ DLL, and I know how to use one (I created and used one myself before discovering Cubiquity), but I can't find the C++ code, nor method documentation.
Is it available, and do you know of a way I can modify the voxel data efficiently with a large range ?

Thank you for reading, I'm available if you need any more info on what I did or tested. :mrgreen:

EDIT: By activating the '-unsafe' option of Cubiquity, the time taken was divided by two :
We are now at 88 ms for a 64^3 generation and 500ms for a 128^3 one :)
We need to go deeper ! :geek:

Author:  David Williams [ Fri Jul 24, 2015 9:24 pm ]
Post subject:  Re: Modifying large quantities of voxels

So you want to modify every voxel every frame? To be honest Cubiquity is not designed for this scenario so you will struggle to get the performance you want. Cubiquity works by generating a mesh from the volume data and assuming that any changes are likely to affect only a small part of this mesh (which works well for explosions, digging, etc), so that most of the mesh data can be reused between successive frames. Generating the mesh and then throwing the whole away one frame later does not seem like an optimal solution.

If I were faced with this requirement I would probably upload the volume data to the GPU each frame and then render it with direct volume rendering approaches (e.g. raycasting) rather than by surface extraction. For example, see:

http://graphicsrunner.blogspot.co.uk/20 ... g-101.html
https://github.com/brianasu/unity-ray-m ... c-textures

I think you might also find something on the asset store.

As for Cubiquity, the performance can indeed be improved but not really by you. The C++ code is not currently available and we don't have a stable API yet so it isn't documented. There is a lot which we can do internally (it currently runs all on one thread!) but you just have to wait for that.

Author:  gus3000 [ Mon Jul 27, 2015 7:00 am ]
Post subject:  Re: Modifying large quantities of voxels

Arf, okay. Thank you for the answer, and for the links.
I guess we'll not use Cubiquity this time, though I'll keep it in mind for future games :p

Thank you and keep up the good work !

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/