Volumes Of Fun http://www.volumesoffun.com/phpBB3/ |
|
Using Polyvox with models http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=170 |
Page 1 of 1 |
Author: | DJDD [ Fri Mar 11, 2011 7:32 am ] |
Post subject: | Using Polyvox with models |
I'm currently loving the method of using voxel-based data structures to store my world, and I'm currently playing around with a way to visually present it all. I'm wondering if anyone has any ideas on how to use more highres models/prefab meshes to designate the voxel points. For example, a cliff-face model on the side of a voxel point that would otherwise be a cube. I'm about to take a look at the CubicSurfaceExtractor() function to see what I can discern about how to iterate through a voxel volume to allocate visual data to it. Please let me know if any of you have any methods or ideas on this. |
Author: | Shanee [ Fri Mar 11, 2011 7:53 am ] |
Post subject: | Re: Using Polyvox with models |
I'm not sure what you are saying. If using DirectX etc you can save it as a mesh and even save as X to hard drive and load for multiple use as normal mesh. |
Author: | DJDD [ Fri Mar 11, 2011 8:21 am ] |
Post subject: | Re: Using Polyvox with models |
What I mean is, instead of using PolyVox's method of serializing the outside of a volume into basic cubes, I would like to provide my own models and meshes to form the outside of the volume given what direction the normals are. |
Author: | kattle87 [ Fri Mar 11, 2011 10:14 am ] |
Post subject: | Re: Using Polyvox with models |
if you are speaking about something like "if material is xxx, then instead of adding a cube, add this specific set of polygons" then I've been thinking about this, too. Probably though the easiest way to do so is create a new class, since this would be no more a cubic extractor, ask for the user some kind of list to the meshes coupled with the materials, change a few lines from the current cubic extractor, and return either a bunch of meshes placed in the right spots, or a single mesh with several different objects, or even avoid getting anything as input and just output a list of where you should be placing your things. |
Author: | David Williams [ Fri Mar 11, 2011 6:54 pm ] |
Post subject: | Re: Using Polyvox with models |
I think you're each describing slightly different but related ideas. kattle87 wants to replace the cubes with a different mesh (e.g. a sphere) whereas DJDD wants to replace individual faces of the cubes with a custom mesh (to make it bumpy, etc). @DJDD - As a first attempt, I think you can use the CubicSurfaceExtractorWithNormals directly. Then you can take the resulting surface mesh and consider the vertices to be in sets of four (you can ignore the index data). Each set of four vertices defines a quad which you want to replace with your own mesh. If you average the positions you get the centre of the quad which should also be the centre of you mesh, and the normals of the four vertices will be the same and you can use these directly. You should also consider whether normal/relief mapping can get the effect you want at a lower cost. @kattle87 - I think you'll need a new surface extractor class for what you want to do but it would be a very simple one. You don't want any index/vertex data as output, you just want a list of which voxels lie on the boundary between solid and empty space. For each of these positions you can then draw a custom mesh. This is also an interesting idea, because on modern hardware you could simply pass the list of points to the geometry shader and have that expand them into your chosen mesh. Or maybe just look into instancing. Both of you should start with the CubicSurfaceExtractorWithNormals as it is simpler than the other CubicSurfaceExtractor, and you should also both be able to make use of the material information in the voxels if you want to (though get the basic version working first). This would let you use different meshes for different voxel materials. |
Author: | DJDD [ Fri Mar 11, 2011 11:49 pm ] |
Post subject: | Re: Using Polyvox with models |
Hi David, Thanks for the comprehensive reply. Your continued support for PolyVox is really great! ![]() Late last night I did take a look at CubicSurfaceExtractorWithNormals and did manage to place a random model in place of each face. Could you expand a little more on what you mean by the below? Quote: You should also consider whether normal/relief mapping can get the effect you want at a lower cost.
|
Author: | David Williams [ Sat Mar 12, 2011 12:31 am ] |
Post subject: | Re: Using Polyvox with models |
Well, I'm not sure what your aim is but I assume you are trying to add more geometric detail to the surface. If this is the case then there are a range of techniques for drawing a single polygon but then adding detail via a heightmap texture. It's a big field, but you could start by looking at this article: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch18.html In particular, in figure 18-11 a simple cube is being drawn, but the geometry looks a lot more complex: ![]() I'm not about your level of graphics knowledge but it's a fairly advanced technique. Note that that is just one of probably hundreds of papers describing similar techniques. You can also google for normal mapping, relief mapping, parallax mapping, displacement mapping for variations on a similar idea. I haven't implemented them myself, though. |
Author: | DJDD [ Sat Mar 12, 2011 1:27 am ] |
Post subject: | Re: Using Polyvox with models |
Ah yes, I know those techniques well (The concepts anyway). I think I need to go for models specifically in this instance however, at least until Tessellation becomes more widespread. Texture based 'virtual' polygons are very hard to make look believable in my experience. Thanks for the in depth walkthrough. ![]() |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |