THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/11/2012 at 00:16, xxxxxxxx wrote:
Cinema 4D Version: R14
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
I thought I'd try writing a metaball implementation to replace the inbuilt one, which is a bit basic. I've run into a problem I can't find the answer to, so I'm posting here in the hope that somebody else has tried it and can give me a hint.
I'm implementing the marching cubes algorithm, which divides a defined volume of the 3D world into cubes (voxels) and then calculates which voxels should contain polygons for the resulting object. That works fine and I can return a polygon object to display on screen.
The problem I have is this. Suppose my metaball is formed from two objects. As long as they are always the same distance apart, the volume of space to render is always the same, even if it moves around. But if one object moves away from the other, how should that be handled? The render volume will increase, but that will also increase the voxel size, leading to an increasingly blocky object. I can increase the number of voxels to compensate for that, but that slows it down and the appearance of the object may change due to the increased resolution.
So... should I:
- define a fixed volume of space which never changes even if the objects move, with the resulting possibility that some input objects could leave the area and are no longer used to calculate the metaball;
- increase the render volume and leave the resolution as it is;
- increase the volume and compensate by increasing the number of voxels;
- try something else altogether.
All the first three work after a fashion, but not in all circumstances. I've looked at numerous metaball implemtentations online, but they all 'cheat' by using option 1 above. That isn't how the current C4D implentation works.
If anyone has ever done this, or implemented marching cubes for something like this, I'd be very interested to know how you did it. Any hints and tips wuld be most welcome!