Towards a better metaball



  • 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:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Hi All,

    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:

    1. 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;
    2. increase the render volume and leave the resolution as it is;
    3. increase the volume and compensate by increasing the number of voxels;
    4. 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!

    Thanks,

    Steve



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/11/2012 at 23:04, xxxxxxxx wrote:

    I would go for option 3, and specify resolution in scene units (e.g. meters or centimeters). Then you can work out how many voxels you need to fill the current volume.

    At a first glance, this seems to be the way it is done in c4d:s metaball object.

    /Filip


Log in to reply