Jump to content
  • Advertisement
Sign in to follow this  
trs79

Marching cubes soft normals math help

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!