Voxelization Using Bullet?

anlumo
Posts: 6
Joined: Thu Nov 29, 2007 3:27 pm

Voxelization Using Bullet?

Post by anlumo »

Hi,

I'm currently working on my master's thesis project. For this, I have to get a voxelized representation of my models. Since I'm already using bullet for other parts of the program, I wonder whether I can use this library for this.

What I really need is the triangle-exact answer to the question "For a given aabb, what is the solid fraction of it?". The easiest way to get an approximation of this would probably be to subdivide the aabb into 8x8x8 aabbs, do a first-hit raytest from every box's center in a random direction and check the intersection's normal. This way I know whether this point is inside or outside, add up the number of inside results and divide by 512 (=8*8*8) to get the solidicity fraction I need.
Can bullet help me for this? I saw that I can do a ray test using btCollisionWorld::rayTest, but maybe there's an easier approach to the whole problem?
I'm using a 128x128x16 grid, which would mean 128x128x16x8x8x8=134,217,728 raytests, which I guess would take quite a while to do. Ideally, I 'd need to do this once per frame, but I guess that's quite impossible yet.

I'd appreciate any help for this. This isn't really the focus of my work, so I'd prefer to have it done in a rather simplistic way.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Voxelization Using Bullet?

Post by Erwin Coumans »

I haven't been thinking much about voxelization of triangle meshes.

One option would be to create a convex decomposition (see ConvexDecompositionDemo), and then using the regular collision detection (penetration depth) to determine the solid fraction.

Alternatively, check out this GPU voxelization approach:
http://www.iii.u-tokyo.ac.jp/~takahiroh ... ation.html

Or perhaps Open Tissue physics library has an implementation for voxelization for their signed distance maps.

Hope this helps,
Erwin
anlumo
Posts: 6
Joined: Thu Nov 29, 2007 3:27 pm

Re: Voxelization Using Bullet?

Post by anlumo »

Thank you for the hints, I'll look into them. I also found a presentation from NVidia from SIGGRAPH 2007 about doing it on the GPU, maybe I can use that one (their approach only takes 2.5ms for a model with much more polygons than mine on a 128^3 grid, so that might be viable even for realtime).