質問

I'd like to create or find an open source metaball skin system, which uses metaballs, voxelization to create meshes. I have 3 years experience in C\C++ and OpenGL. Yet I don't have an idea on how to tackle this system. What I want is a way to implement or a way to structure a system like this. Any ideas/thoughts?

Here's a link of liner note of someone who was working on an engine that uses this system: http://chrishecker.com/My_liner_notes_for_spore

役に立ちましたか?

解決

I have 3 years experience in C\C++ and OpenGL. Yet I don't have an idea on how to tackle this system.

I find this very hard to believe.

What you need:

  1. Marching cubes algorithm. Or marching tetrahedra, if you worry about patents.
  2. Meta balls formula

Meta particle system consist of several "meta balls", which "emit" "energy". "Energy" emmited by meteball can be positive/negative, and normally fall off with a distance from metaball. Falloff is kinda similar to point light, except that instead of point any mathematcial body can be used (as long as you can calculate distance to it).

For any given point in space "energy" of metaball system can be, for example, sum of all energies (they fall off with distance, remember?) of all meta bodies in the system.

Now, given this "energy field", you visualize metabody system as if you would visualize iso surface (or any other procedural surface).

For any point of space, if "energy" is below certain thresold, this point is outside of "mesh" formed by meta particle. If "energy" is above that thresold, point is inside the "mesh" formed by meta particles.

Two points give you segment, and knowing line segment, you can calculate point at which segment crosses "surface" of the mesh.

Now, just walk through certain region of space using "marching cubes" algorithm, and you'll get a mesh.

Normals are calculated by sampling energy levels at small offsets (x/y/z +- 0.01, for example) of the point that lies on the surface of mesh.

If this explanation is hard, then I think nvidia sdk had examples for marching cubes algorithm. Read example, apply same ideas to meta particles.

Here's what you can get with this algorithm: enter image description here

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top