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

How do I pick good density values?
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=524
Page 1 of 1

Author:  emacaco [ Sat Jul 20, 2013 5:56 am ]
Post subject:  How do I pick good density values?

I realize that I may be asking for a simple solution to a very complicated problem here but I just got set up and started playing around. Naturally the first thing I tried was basically the tutorial which makes a sphere. When I run that through the marching cubes extractor the resulting mesh seems to try to stick to the cube form and creates "ripples" on the surface of the sphere. As I understand it the problem is this sphere doesn't use density/material values to smooth along the edge, it simply sets things as solid or empty.

I have a very rudimentary understanding of how the densities are used in the marching cubes algorithm to sort of use a weighted interpolation of where to put the vertices between voxels. By playing around with values in the tutorial I managed to set values that smooth the sphere out quite nicely. It seems we want values on the "surface" to be approximately at the threshold value for the marching cubes algorithm and we want it to increase/decrease fairly rapidly on the solid/empty side of the surface. At least that's what my messing with values leads me to conclude.

On a sphere this isn't too difficult to calculate. My question then is how do I find good density values as a general case? How do I find new good values when voxels are added/removed from a volume? I'm guessing the low pass filter included in PolyVox has something to do with this but I don't understand the principles behind how good values should be calculated well enough to really know what I'm doing. I'm also guessing this is what is meant by "voxel smoothing" that I've seen mentioned in other threads, but those threads went over my head.

Any help would be appreciated.

Author:  ker [ Sat Jul 20, 2013 6:42 am ]
Post subject:  Re: How do I pick good density values?

have a look at Shanee's thread: viewtopic.php?f=2&t=168

she has several tools there to draw basic shapes. one of them is a perfect sphere.

Author:  David Williams [ Sun Jul 21, 2013 7:28 am ]
Post subject:  Re: How do I pick good density values?

emacaco wrote:
It seems we want values on the "surface" to be approximately at the threshold value for the marching cubes algorithm and we want it to increase/decrease fairly rapidly on the solid/empty side of the surface.


Yes, basically the the voxel values specify the density at positions which lie on the voxel grid, and for all other positions (i.e. between the voxels) the density is calculated by linear interpolation. Vertices are then generated such that they have a position where the (interpolated) density value is equal to the threshold. The resulting mesh should separate position with a density below the threshold from positions with a density above the threshold.

I'm sorry, it's not that easy to explain! But it's the same as any other Marching Cubes implementation.

emacaco wrote:
My question then is how do I find good density values as a general case?


I have to admit I don't have much experience here, though I'm going to have to do some research for Cubiquity. If you use 3D Perlin noise then you automatically get a volume which varies smoothly from high to low values. If you generate your data another way then it might be easiest to make a 'binary' volume and then blur it (i.e. with the low pass filter).

If you want to make realtime editing tools which modify the volume while maintaining the property that it should be smooth then I think it get's more tricky. Ker's links above are a good starting point. In the sphere brush you can see that Shanee modifys the volume data by an amount which varies depending on how close it is to the centre of the bruch - i.e. it has some fall-off.

It might be worth experimenting in 2D first with a greyscale image and some oth the 'soft' brushes in PhotoShop, to get an idea of the expected behaviour.

Author:  petersvp [ Thu Jul 17, 2014 3:49 pm ]
Post subject:  Re: How do I pick good density values?

In Crafterria, our volumes are always binary. E.g. Integer material IDs + data, like in Minecraft.

When generating the mesh we copy and smooth the volume data on the fly. Even using the pickaxe results in smooth terrain then.

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