# Marching cubes soft normals math help

This topic is 2624 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.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633687
• Total Posts
3013327
×