Skip to main content
GameDev.net gamedev.net
🔒 Locked

marching cubes or something else?

Started by bbtrb Jun 14, 2010 at 9:21 AM 4 replies 3.4k views
Original Post
bbtrb
bbtrb
Hi all,

I'd like to visualize a "pseudo-liquid" in real time. The idea is to have particles interacting and moving within a potential. To keep the number of particles low, each particle is surrounded by a fuzzy sphere, defining a scalar field in the computational domain at each time step. The obtained isosurface should then represent the liquid surface.

Now my question:
I have used a naive marching cubes algorithm for problems like this before, but the performance is not sufficient for a real time application. My data is mostly sparse, so I'm looking into an octree/edge tree implementation and I've found literature that looks promising (e.g. http://www.cs.jhu.edu/~misha/MyPapers/SGP07a.pdf).

But before diving in and following the "at first don't write any code" idea: is there another (maybe equally efficient) alternative to marching cubes??

All help is greatly appreciated!

Thanks
Tom
stalef
stalef
Have you looked into doing marching cubes on the GPU using geometry shaders?
TyrianFin
TyrianFin
Direct ray marching on GPU?

Now that there is ATI:s and NVidias order-independent transparency (OIT).
It`s bossibe to do new kind of raymarcher that is uber fast.

/Tyrian
Hodgman
Hodgman
Ray-marching through a distance-field might could well be fast enough.
If at any point in this field, you can obtiain the shortest distance to the 'surface', then you can use that as your step size while 'marching' through the field. This allows you to take big steps through empty space and still never step through the surface.

You could either generate this 3D distance-field each frame from your particle data, and then fetch values from it at every step in the pixel shader (e.g. for each step, fetch distance from texture), or if you've only got a few particles, you could evaluate the particles directly in the pixel shader (e.g. for each step, calc distance for each particle).
mokaschitta
mokaschitta
I implemented raycasted realtime metaballs aswell, not using distance fields though, but that might be another optimization. I used spatial hashing on the GPU aswell as bounding spheres, which also saved the ray start and end positions to at least skip that space.
bbtrb
bbtrb
Thanks for all your replies!

It seems that for this kind of problems it becomes mandatory for me to move my applications closer to the GPU and start with advanced stuff :)

After reading into the literature I found, I think that raycasting is the way to go, thank you for that. I'll implement the marching cubes algorithm on the GPU too, as this seems to be a nice exercise.

Has anyone of you some code snippets that show a naive implementation of raycasting on the GPU? (No tutorial or anything, just code)

I'd like to think about possible optimizations on my own and will have to integrate it into my engine anyways, but it would help a ton to get started.

Thanks again!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.