| Volumes Of Fun http://www.volumesoffun.com/phpBB3/ |
|
| Ogre mesh to PolyVox http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=426 |
Page 2 of 2 |
| Author: | Crash(Overwrite()) [ Mon Sep 03, 2012 10:38 am ] |
| Post subject: | Re: Ogre mesh to PolyVox |
The problem was the .mesh file it self was corrupted.... lol ^^... now everything works the way it should.... now i have to fill the gaps between the voxels... let's see if i get this done ^^ |
|
| Author: | David Williams [ Tue Sep 04, 2012 8:10 am ] |
| Post subject: | Re: Ogre mesh to PolyVox |
Crash(Overwrite()) wrote: now i have to fill the gaps between the voxels... let's see if i get this done ^^ I can describe an approach I have used in the past (though I can't say if it is the best solution). Basically, try iterating over triangles in your mesh rather than iterating over vertices. Write a function which takes a triangle as input and does one of two things:
This should fill in the gaps between the vertices, though you will still end up with a hollow shell. |
|
| Author: | Crash(Overwrite()) [ Tue Sep 04, 2012 8:27 am ] |
| Post subject: | Re: Ogre mesh to PolyVox |
David Williams wrote: can describe an approach I have used in the past (though I can't say if it is the best solution). Basically, try iterating over triangles in your mesh rather than iterating over vertices. Write a function which takes a triangle as input and does one of two things:If the vertices of the triangle are all very close together (all inside the same voxel) then set this voxel to solid.Else split the triangle into three triangles by creating a new vertex at the centre, and then apply the process recursively to those.This should fill in the gaps between the vertices, though you will still end up with a hollow shell. yep i will try that thx again ...^^ and a hollow shell is ok for now .... i can try to fill it later if that is neccessary.... |
|
| Author: | KuroSei [ Sat Oct 06, 2012 3:46 am ] |
| Post subject: | Re: Ogre mesh to PolyVox |
The hollow shell could be filled with a 3D implementation of floodfill or similar recursive algorithms. The problem is, that the mesh has to be closed for that or it will mess up horribly. One other way would be to generate the voxeldata in a complete different way... I decided to use a divide and conquer algorithm for Voxelization... (Later on in process of my project) Code: 1. Decide on a size for the Volume. ( I am going to compute it from a wanted resolution and the bounding volume of the given meshes. ) 2. Test the given "CollisionBox" against the Mesh. - If it collides: - Is it as small as a Voxel? -> Set it solid. - Else: Split it into 8 smaller CollisionBoxes and repeat step 2. -If not: Discard the whole box. 3. You got it... Save the Volume. ( You could convenietly save it as an octree that way. ) The given Term "CollisionBox" ( Im not very creative with names... And english isn't my native language, so i apologize... ) simply means, that we got a defined area which we can test against the mesh. We have to test against a meshaccurate bounding, not against the mesh boundingbox, which makes this approach kinda expensive and nothing suitable for a real time approach if it isn't done on an extern thread... ( Does this method even sound viable? |
|
| Author: | David Williams [ Sat Oct 06, 2012 3:05 pm ] |
| Post subject: | Re: Ogre mesh to PolyVox |
I guess this sounds reasonable... it's quite hard to imagine. So the idea is that this creates a filled in volume rather than a hollow shell? But it can still fail if the mesh isn't closed? There are other approaches you can use, for example you can iterate over each voxel and determine whether it is inside the mesh by casting a ray and counting how many triangles it intersects. If it's an odd number the voxel is inside, otherwise it is outside. i.e a 3D version of the 'point in polygon' test. Maybe check out this article as well: http://blog.wolfire.com/2009/11/Triangle-mesh-voxelization Overall I don't know what the best approach is... you will have to experiment a bit |
|
| Author: | KuroSei [ Sat Oct 06, 2012 3:21 pm ] |
| Post subject: | Re: Ogre mesh to PolyVox |
David Williams wrote: I guess this sounds reasonable... it's quite hard to imagine. So the idea is that this creates a filled in volume rather than a hollow shell? But it can still fail if the mesh isn't closed? The 3D Floodfill could fail. Therefor i thought about using the second method. I guess it should work fine. The problem is that one has to generate accurate Meshboundings. Does this "point" in polygon" thing realy work? In case of holes it could fail again, wouldnt it? |
|
| Author: | David Williams [ Mon Oct 08, 2012 12:53 pm ] |
| Post subject: | Re: Ogre mesh to PolyVox |
KuroSei wrote: Does this "point" in polygon" thing realy work? In case of holes it could fail again, wouldnt it? The point in polygon test will indeed fail if there are holes in the mesh. So are you saying that your proposed solution would work even if there are holes? Will it also work if the mesh is concave, or if it consists of more than one components? If you can find an algotirhm which behaves well in all these situations then that's great, but you might find it is easier to just make sure your input mesh is closed. |
|
| Page 2 of 2 | All times are UTC |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|