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 the main toolbar next to the "Manage Selection Sets" button and name the set "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 = sgsdk_LoadPipeline "D:/Pipelines/remeshingPipelineWithBaking.json"
-- set the clipping selection set
bResult = sgsdk_SetSetting remeshingPipeline "RemeshingProcessor/RemeshingSettings/ClippingGeometrySelectionSetName" "ClippingSelectionSet"
-- pass the settings object to the Simplygon function
bResult = sgsdk_RunPipelineOnSelection remeshingPipeline
-- clear all pipelines
sgsdk_ClearPipelines()
from pymxs import runtime as rt
# load a remeshing pipeline
remeshingPipeline = rt.sgsdk_LoadPipeline('D:/Pipelines/remeshingPipelineWithBaking.json')
# set the clipping selection set
bResult = rt.sgsdk_SetSetting(remeshingPipeline, 'RemeshingProcessor/RemeshingSettings/ClippingGeometrySelectionSetName', 'ClippingSelectionSet')
# pass the settings object to the Simplygon function
bResult = rt.sgsdk_RunPipelineOnSelection(remeshingPipeline)
# clear all pipelines
rt.sgsdk_ClearPipelines()
Resulting mesh to the right: