A VoronoiFracture object represents a Voronoi Fracture MoGraph generator. The class provides safe access to the point sources referenced, owned and used by the generator. It is defined in the lib_voronoifracture.h header file.

// This example creates a Voronoi Fracture object,
// adds an input Sphere object, a Rigid Body tag and a point generator.
// create Voronoi Fracture object
if (!fractureObject)
return false;
doc->InsertObject(fractureObject, nullptr, nullptr);
// add a Rigid Body tag (ID 180000102)
BaseTag* rigidBodyTag = BaseTag::Alloc(180000102);
if (rigidBodyTag)
// add sphere as input object
if (!sphere)
return false;
doc->InsertObject(sphere, fractureObject, nullptr);
// add point source
BaseObject* pointGenerator = fractureObject->AddPointGenerator(pointCreatorType, NOTOK, nullptr);
// configure point generator
if (pointGenerator)


A VoronoiFracture object can be accessed like any other object.

// This example accesses the currently selected
// Voronoi Fracture object to print the number
// of used sources.
BaseObject* obj = doc->GetActiveObject();
// check if the active object is a Voronoi Fracture object (ID 1036557)
if (obj && obj->IsInstanceOf(1036557))
VoronoiFracture* voronoiFracture = static_cast<VoronoiFracture*>(obj);
// get source count
const Int32 srcCnt = voronoiFracture->GetSourcesCount();
// print source count
const String srcCntStr = String::IntToString(srcCnt);
GePrint(voronoiFracture->GetName() + " uses " + srcCntStr + " sources.");


VoronoiFracture objects are created with the usual tools:

// This example creates a Voronoi Fracture object as the new
// parent object of the currently active object.
// get active object
BaseObject* activeObject = doc->GetActiveObject();
if (!activeObject)
return false;
// create voronoi fracture
if (!fracture)
return false;
// insert voronoi fracture
doc->InsertObject(fracture, nullptr, nullptr);
// insert active object under the fracture object
doc->InsertObject(activeObject, fracture, nullptr);


The IDs of the standard parameters of a VoronoiFracture object are defined in the omograph_fracturevoronoi.h header file.

The list of point sources must only be edited through the dedicated functions of the VoronoiFracture class (see below).


Both scene objects and dedicated point generator objects can be used to define the position of Voronoi points inside the mesh volume. The following functions allow to add, remove and edit these point sources. The type ID of point generator objects is Ovoronoipointgenerator.

Access Sources

The VoronoiFracture class provides functions to access the object and generator sources referenced in the "Sources" parameter.

// This example loops through all point sources of the given
// Voronoi Fracture object and prints their names.
// get source count
const Int32 srcCnt = voronoiFracture->GetSourcesCount();
// loop through all sources
for (Int32 i = 0; i < srcCnt; ++i)
// get source
BaseObject* source = voronoiFracture->GetSource(i);
if (source)
// print source name
const String sourceName = source->GetName();
GePrint("Source: " + sourceName);

Remove Sources

The VoronoiFracture class also provides functions to safely remove objects and generators from the "Sources" parameter.

// This example removes all point generator sources from the
// given Voronoi Fracture object.
Int32 index = NOTOK;
// loop through all point generators until no point generator is found anymore
while (voronoiFracture->GetSourceByType(Ovoronoipointgenerator, NOTOK, &index))

Add Sources

Using the VoronoiFracture functions it is safe to add new sources and generators to the "Sources" parameter.

Point generators are represented by dedicated BaseObject elements that are owned by the VoronoiFracture object. To configure such a point generator one can simply edit the parameters of the corresponding BaseObject. The parameter IDs of these parameters are defined in opointcreator_panel.h.

// This example adds a shader generator source to the given
// Voronoi Fracture object and adds a shader.
BaseObject* shaderSource = voronoiFracture->AddPointGenerator(shaderGenerator, Xnoise);
if (shaderSource)
// configure generator

The VoronoiFracture object can also use external objects as sources of points:

The IDs for these settings are defined in tfracturevoronoi.h.

// This example creates a new cube and uses it
// as a point source in the given VoronoiFracture object.
if (!cube)
return false;
doc->InsertObject(cube, nullptr, nullptr);
// use as source object
BaseContainer* settings = voronoiFracture->GetSourceSettingsContainerForObject(cube);
if (settings)

Further Reading