Clipping geometries
There are often cases where geometry does not align, one or more meshes that intersects with each other, is covered by other objects or simply sticks out for no apparent reason. A common case is where foliage, rocks and buildings intersects the ground plane/geometry, which can have a negative impact on performance.
Simplygon provides a clipping geometry feature that allows the user to specify a clipping geometry. The clipping geometry will (for remeshing) clip everything that intersects with the clipping geometry and remove triangles that are in the negative normal direction of the surface.
To be able to clip a geometry when doing Remeshing (or any other optimization that supports clipping geometry) a clipping selection set needs to be created. Go to Create->Sets->Set while the clipping geometry is selected in the viewport, let's name it "ClippingSelectionSet" as in the screenshot below.
Selection sets:
The next step is to make Simplygon aware of which selection set to use, this can be accomplished by assigning the set using the Simplygon UI, but in this case we'll do it via script. In the script below we'll load a remeshing pipeline from file, then simply change the clipping set name.
All selection sets specified in the Pipeline will get exported to Simplygon automatically, there's no need to select the clipping geometry.
// load a remeshing pipeline
$remeshingPipeline = `SimplygonPipeline -l "D:/Pipelines/remeshingPipelineWithBaking.json"`;
// set the clipping selection set
$bResult = `SimplygonPipeline -ss "RemeshingProcessor/RemeshingSettings/ClippingGeometrySelectionSetName" -v "ClippingSelectionSet" $remeshingPipeline`;
// pass the settings object to the Simplygon command
$bResult = `Simplygon -so $remeshingPipeline`;
// clear all pipelines
SimplygonPipeline -cl;
import maya.cmds as cmds
# load a remeshing pipeline
remeshingPipeline = cmds.SimplygonPipeline(l = 'D:/Pipelines/remeshingPipelineWithBaking.json')
# set the clipping selection set
bResult = cmds.SimplygonPipeline(remeshingPipeline, ss = 'RemeshingProcessor/RemeshingSettings/ClippingGeometrySelectionSetName', v = 'ClippingSelectionSet')
# pass the settings object to the Simplygon command
bResult = cmds.Simplygon(so = remeshingPipeline)
# clear all pipelines
cmds.SimplygonPipeline(cl = True)
Resulting mesh to the right: