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


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How do I pick good density values?
PostPosted: Sat Jul 20, 2013 5:56 am 

Joined: Tue Jul 16, 2013 11:15 pm
Posts: 4
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How do I pick good density values?
PostPosted: Sat Jul 20, 2013 6:42 am 
User avatar

Joined: Wed Jan 26, 2011 3:20 pm
Posts: 203
Location: Germany
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How do I pick good density values?
PostPosted: Sun Jul 21, 2013 7:28 am 
Developer
User avatar

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


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How do I pick good density values?
PostPosted: Thu Jul 17, 2014 3:49 pm 

Joined: Tue Apr 08, 2014 5:10 pm
Posts: 124
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.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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