It is currently Tue Dec 10, 2019 12:02 am


All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: General Voxel Questions
PostPosted: Sun Jan 23, 2011 11:01 pm 

Joined: Thu Jan 20, 2011 10:43 pm
Posts: 11
Hi,

I'm looking into the feasibility of making a voxel tool, and just have some general questions on the technology. The tool operates on voxelized meshes.

    1. Approximately how much would disk space would a typical RLE 2048x2048x2048 voxel file use (e.g. storing the voxelization high detail character)?

    2. How long would it take to load this RLE voxelization, marching cube it recursively to different LOD's and send them to the GPU? How long would it take to load a detailed game-scene (trees/rock/terrain/characters) by this approach?

    3. I'm not really sure how texture storage works with voxel methods.. could you explain this/point me to the right class/bit of reading? does each voxel store a material enum.. or point to a normal, how does this get shared when converted to triangles?

    4. Would it be possible to store additional data (e.g two bytes and one float) on some of the voxels, which can get parsed to the GPU vertice storage, as generated from the marching cubes?

Thanks,
Chris


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Mon Jan 24, 2011 5:25 am 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
I'm not really an expert on voxels but I will input my 2cent:

1. RLE depends on how noisy your data is.

1 and 2. that's a hard question for me. It depends? Well, RLE is compression is very fast, that's for sure. However, the compression rate is very much dependent on how noisy it is and there is definitely a limit on how much you can compress with RLE. RLE is a pretty simple algorithm that works with well with "bitmap" type of data.

3. Not sure if you are asking how to texture voxels. Look up triplanar texturing (http://www.google.com/search?hl=en&sour ... planar+tex)

4. PolyVox Volume is templatizied on voxel data type, it's a volume of homogeneous data-type.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Mon Jan 24, 2011 9:21 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Chris wrote:
I'm looking into the feasibility of making a voxel tool, and just have some general questions on the technology. The tool operates on voxelized meshes.


Ok, these are rather vague estimates... hopefully accurate to within an order or magnitude :-)

Chris wrote:
1. Approximately how much would disk space would a typical RLE 2048x2048x2048 voxel file use (e.g. storing the voxelization high detail character)?


1) As beyzend says this can vary hugely depending on your exact data, but in general I have seen that zipping up the data reduces it to a few percent of the raw data size. I think that a compression rate of 100 to 1 is probably the right kind of level to aim for. Assuming 1 byte per voxel, your raw volume would be 2048^3 = 8GB of data. So if you compress it I would estimate 80MB.

Chris wrote:
2. How long would it take to load this RLE voxelization...


I'm not sure how long the loading would take, I've never really measured this in PolyVox. Perhaps you can find some real-life hard drive transfer speeds (sustained, not burst)?

Chris wrote:
marching cube it...


As I recall, PolyVox can run the Marching Cubes algorithm on a 256^3 volume in about one second on my two year old PC. Logically this means 64 seconds for your much larger volume. That's on only one core though, and it's quite easy parallelise so you should expect a linear increase as you increase the number of cores.

Chris wrote:
recursively to different LOD's...


Not exactly sure... probably each LOD level will take 1/8th the time of the one above it. So maybe add 15% to the non-lod time. But this could vary depending on exactly where the bottleneck is.

Chris wrote:
and send them to the GPU?


Again I'm not sure... but you should be able to find details on how fast the bus in on modern GPUs. Maybe estimate 30 bytes per vertex and 2 vertices for each partially occupied cell (some vertex sharing will also take place).

Chris wrote:
How long would it take to load a detailed game-scene (trees/rock/terrain/characters) by this approach?


In total... maybe one or two minutes? Let's say two.

Chris wrote:
3. I'm not really sure how texture storage works with voxel methods.. could you explain this/point me to the right class/bit of reading? does each voxel store a material enum.. or point to a normal, how does this get shared when converted to triangles?


PolyVox just stores a material ID per voxel. This can be interpreted as a color, a texture, or what ever you wish at rendering time. If your textureing voxel terrain then triplanar texturing is a good option, as beyzend pointed out.

Chris wrote:
4. Would it be possible to store additional data (e.g two bytes and one float) on some of the voxels, which can get parsed to the GPU vertice storage, as generated from the marching cubes?


In principle, yes. The traditional Marching Cubes algorithm just operates over a density field, so really the material ID is an example of the kind of data you describe. It's a integer value in the volume, and gets converted into a float and attached to the vertices which are passed to the GPU.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Mon Jan 24, 2011 10:36 pm 

Joined: Thu Jan 20, 2011 10:43 pm
Posts: 11
Thanks so much for these detailed approximations, both of you; they really help give me an idea on where to flesh out the framework. Before reading this, I thought the bottleneck would bias to one of processing/{diskspace/memory} - but instead it seems much more of a fine-balancing act (especially with detail generators on the mesh).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Wed Mar 02, 2011 11:37 am 

Joined: Thu Jan 20, 2011 10:43 pm
Posts: 11
Hi, this is quite off-topic, but perhaps some of the developers here have done similar in the past, and can help me. I'm just doing final optimizations for a paper, the C++ implementation isn't using PolyVox.

Each voxel stores 4 bytes of data. I want to crudely pack a float32 Vec "normal" into the first two bytes of a voxel. And the inverse function; from the first two bytes, compute a crude normal vector where xyz are float32.

Does anyone have any advice on a "correct" way to do this?
Thank you


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Wed Mar 02, 2011 5:53 pm 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
There are several ways to do this I think but I've never done it myself (not there yet).

http://mynameismjp.wordpress.com/2009/0 ... ordinates/

http://www.opengl.org/discussion_boards ... ber=221234


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Wed Mar 02, 2011 6:01 pm 

Joined: Thu Jan 20, 2011 10:43 pm
Posts: 11
Thanks an awful for lot for these links, they look very promising. I'm just heading out, so will look again in a few hours.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: General Voxel Questions
PostPosted: Wed Mar 02, 2011 11:29 pm 

Joined: Thu Jan 20, 2011 10:43 pm
Posts: 11
Okay, I just checked them out. I'm not sure if they're quite what i'm after. They seem to convert a float3 xyz into a float2 xy. In some of the deeper links, they pack normals from half3 xyz (48-bits) to half2 (32-bits).

What i'm after is something much more crude, packing float3 (96-bits) into just two bytes (16-bits, or one U16). I love the idea of taking advantage of spherical coordinates, so will look into trying this with some packing.

Thanks again, has given me lots of thought for trying stuff. Let me know if anyone can think of a nice solution; will post immediately when/if I get it working elegantly.
Chris

Edit: Got it working, thanks to some additional help :)

Code:
Color Voxelizer::nordecol(C Vec &v, C U16 &misc) { // encode 96-bit normal and 16-bit misc data, into just 32-bits!

   Color out;   out.r = Round(Lerp(0,255,LerpRS(-1.0f,1.0f,v.x)));   // 8-bit prec
            out.g = Round(Lerp(0,127,LerpRS(-1.0f,1.0f,v.y)));   // 7-bit prec

   if(v.z<0) out.g |= 128; // encode z sign in last y bit

   // misc data
        ...

   return out;
}

Norde Voxelizer::colnorde(C Color &col) { // decode 32-bit color to 96-bit normal and 16-bit misc data

   // length(v)==1 -> Sqrt(v.x*v.x + v.y*v.y + v.z*v.z)==1 -> v.x*v.x + v.y*v.y + v.z*v.z==1 -> v.z*v.z==1 - v.x*v.x - v.y*v.y -> v.z==Sqrt(1 - v.x*v.x - v.y*v.y)
   Norde out;   out.nrm.x=Lerp(-1,1,LerpRS(0,255,col.r    ));
            out.nrm.y=Lerp(-1,1,LerpRS(0,127,col.g&127));
            out.nrm.z=Sqrt(Sat(1 - out.nrm.x*out.nrm.x - out.nrm.y*out.nrm.y));
   
   if(col.g&128) CHS(out.nrm.z); // if encoded z sign bit in y is on then change sign of v.z
   out.nrm.normalize();

   // misc data
        ...

   return out;
}


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net