It is currently Sat Aug 22, 2020 4:30 am


All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Using Polyvox with models
PostPosted: Fri Mar 11, 2011 7:32 am 

Joined: Tue Mar 08, 2011 3:57 am
Posts: 46
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Fri Mar 11, 2011 7:53 am 

Joined: Fri Feb 18, 2011 8:41 pm
Posts: 173
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Fri Mar 11, 2011 8:21 am 

Joined: Tue Mar 08, 2011 3:57 am
Posts: 46
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Fri Mar 11, 2011 10:14 am 

Joined: Thu Mar 10, 2011 10:34 am
Posts: 19
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Fri Mar 11, 2011 6:54 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Fri Mar 11, 2011 11:49 pm 

Joined: Tue Mar 08, 2011 3:57 am
Posts: 46
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Sat Mar 12, 2011 12:31 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
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:

Image

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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Using Polyvox with models
PostPosted: Sat Mar 12, 2011 1:27 am 

Joined: Tue Mar 08, 2011 3:57 am
Posts: 46
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. :)


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 3 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