Sign in to follow this  
trs79

Marching cubes soft normals math help

Recommended Posts

Hi All,

I'm trying to use Physx fluid particles and then create an isosurface with the marching cubes algorithm (speficially the Cuda SDK demo version, can be seen here: http://www.youtube.com/watch?v=VDPNi6YqOhs )

In the example the normals are hard, I'd like a smooth version to make the particles look more fluid-like (similar to water). My understanding is the normals are calculated from a function that is computed via the density of the particles? Unfortunately I never took enough math to learn differential equations or the like, and now it's biting me. Does anyone have any pointers in the right direction? Thanks!

Share this post


Link to post
Share on other sites
If the function is not differentiable (or you have no way to differentiate it), then you can approximate the partial derivatives of the density function like:

normal = normalise( [ p(x+eps,y,z)-p(x-eps,y,z) ; p(x,y+eps,z)-p(x,y-eps,z) ; p(x,y,z+eps)-p(x,y,z-eps) ] )

for some small epsilon.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this