Marching cubes soft normals math help

This topic is 2936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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:
)

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 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.

• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 9
• 15
• 21
• 26
• 11