It is currently Sat Aug 22, 2020 2:02 pm


All times are UTC




Post new topic Reply to topic  [ 14 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Fluids with PolyVox?
PostPosted: Sat Jun 04, 2011 10:59 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
David Williams wrote:
The other aspect is that there's more to PolyVox than the surface extractors - for example how should the raycasting respond to transparent voxels? Or the ambient occlusion generator? Simply flagging voxels as solid or transparent might be more useful here.


You already created the callback-raycast (which btw I'm using quite successfully, it's really great, thanks!)
and that should be sufficient for anyone raycasting through transparent stuff... maybe some default ones could be implemented, but I don't believe this to be a problem.

Quote:
PolyVox wouldn't dictate what data should be stored per voxel - just what data a voxel should be able to provide. For example, a voxel already has both getMaterial() and getDensity() methods, but if only a material is being stored (e.g. Material8) then the density is simply computed based on the material (material 0 has a low density, any other material has a high density). So I agree with you, and the 'material register'would be an implementation detail of the voxel type.


so basically the voxel class would just get another function like renderBorder(VoxelType other) which would return whether a border should be rendered, and isSolidBorder(VoxelType other) which would return whether the extractor should render here AND not render anything inside


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Fluids with PolyVox?
PostPosted: Sat Jun 04, 2011 11:05 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
There are actually two RayCast classes - the normal RayCast and the RayCastWithCallback. The second uses the result of a callback function to decide whether to continue casting, so it should be possible to get any desired behaviour using this. It's slower though, as it has to make a function call for every voxel it touches.

I'll give some more thought to what the regular Raycast class should do...

Edit: Looks like I posted at the same time as ker.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Fluids with PolyVox?
PostPosted: Sat Jun 04, 2011 11:13 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
ker wrote:
so basically the voxel class would just get another function like renderBorder(VoxelType other) which would return whether a border should be rendered, and isSolidBorder(VoxelType other) which would return whether the extractor should render here AND not render anything inside


We also need to ensure that in the case of the smooth surface extractor it can generate a smmoth surface between empty space and transparent material, between adjacent transparent materials, and between transparent and solid materials. Keeping the surface smooth is going to mean using appropriate density values.

I can imagine that empty space has a low density, transparent material have a medium density, and solids have a high density. Maybe the renderBorder() function would also need to return the density threshold which would be used for the extraction. Some care also needs to be taken where empty, transparent, and solid material all meet in the same place. I'm not sure what happens here.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Fluids with PolyVox?
PostPosted: Sun Jun 05, 2011 10:59 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I did some more thinking about this, and the smooth surface extractor is definitely the more difficult case. This is because the CubicSurfaceExtractor only looks at two voxels at a time so a hasSurface(material1, material2) funtion is quite straightforward. But the smooth surface extractor looks at eight voxels at a time, meaning it gets more complex. We could have a situation where a single cell contains eight different materials, some transparent and some not.

Maybe it should look at a the eight voxels and identify how many unique material there are, then perform the surface extraction for each unique pair. Or maybe we should just place contraints here and say that (for example) you can't place two transparent areas next to eachother.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 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