Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Fluids with PolyVox?
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=219
Page 2 of 2

Author:  ker [ Sat Jun 04, 2011 10:59 am ]
Post subject:  Re: Fluids with PolyVox?

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

Author:  David Williams [ Sat Jun 04, 2011 11:05 am ]
Post subject:  Re: Fluids with PolyVox?

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.

Author:  David Williams [ Sat Jun 04, 2011 11:13 am ]
Post subject:  Re: Fluids with PolyVox?

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.

Author:  David Williams [ Sun Jun 05, 2011 10:59 am ]
Post subject:  Re: Fluids with PolyVox?

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.

Page 2 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/