Skip to content
On this page

Simple Quad Reduction pipeline

This example shows how to create a new QuadReductionPipeline and how to set basic reduction parameters.

MEL
// create a QuadReductionPipeline object
$quadReductionPipeline = `SimplygonPipeline -c "QuadReductionPipeline"`;

// set DefaultTangentCalculatorType to OrthonormalRightHanded (0)
$bResult = `SimplygonPipeline -ss "GlobalSettings/DefaultTangentCalculatorType" -v 0 $quadReductionPipeline`;
$defaultTangentCalculatorType = `SimplygonPipeline -gs "GlobalSettings/DefaultTangentCalculatorType" $quadReductionPipeline`;
print ("DefaultTangentCalculatorType: " + $defaultTangentCalculatorType + "\n");

// set the triangle ratio to 50%
$bResult = `SimplygonPipeline -ss "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio" -v 0.5 $quadReductionPipeline`;
$eeductionTargetPolygonRatio = `SimplygonPipeline -gs "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio" $quadReductionPipeline`;
print ("ReductionTargetPolygonRatio: " + $eeductionTargetPolygonRatio + "\n");

// set the reduction target to ReductionTargetPolygonRatio
$bResult = `SimplygonPipeline -ss "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled" -v true $quadReductionPipeline`;
$reductionTargetPolygonRatioEnabled = `SimplygonPipeline -gs "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled" $quadReductionPipeline`;
print ("ReductionTargetPolygonRatioEnabled: " + $reductionTargetPolygonRatioEnabled + "\n");

// disable triangle count reduction target
$bResult = `SimplygonPipeline -ss "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled" -v false $quadReductionPipeline`;
$reductionTargetPolygonCountEnabled = `SimplygonPipeline -gs "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled" $quadReductionPipeline`;
print ("ReductionTargetPolygonCountEnabled: " + $reductionTargetPolygonCountEnabled + "\n");

// disable max deviation reduction target
$bResult = `SimplygonPipeline -ss "QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled" -v false $quadReductionPipeline`;
$reductionTargetMaxDeviationEnabled = `SimplygonPipeline -gs "QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled" $quadReductionPipeline`;
print ("ReductionTargetMaxDeviationEnabled: " + $reductionTargetMaxDeviationEnabled + "\n");

// disable onscreensize reduction target
$bResult = `SimplygonPipeline -ss "QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled" -v false $quadReductionPipeline`;
$reductionTargetOnScreenSizeEnabled = `SimplygonPipeline -gs "QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled" $quadReductionPipeline`;
print ("ReductionTargetOnScreenSizeEnabled: " + $reductionTargetOnScreenSizeEnabled + "\n");

// more settings can be set for the Reduction pipeline,
// see Pipeline documentation and/or inspect the generated file
// that is saved out by this script!

// save the generated Pipeline object to file for later use
$bResult = `SimplygonPipeline -s "D:/Pipelines/Reduction.json" $quadReductionPipeline`;

// clear all pipelines
SimplygonPipeline -cl;
python
# create a QuadReductionPipeline object
quadReductionPipeline = cmds.SimplygonPipeline(c = 'QuadReductionPipeline')

# set DefaultTangentCalculatorType to OrthonormalRightHanded (0)
bResult = cmds.SimplygonPipeline(quadReductionPipeline, ss = 'GlobalSettings/DefaultTangentCalculatorType', v = 0)
defaultTangentCalculatorType = cmds.SimplygonPipeline(quadReductionPipeline, gs = 'GlobalSettings/DefaultTangentCalculatorType')
print ('DefaultTangentCalculatorType: ' + str(defaultTangentCalculatorType) + '\n')

# set the triangle ratio to 50%
bResult = cmds.SimplygonPipeline(quadReductionPipeline, ss = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio', v = 0.5)
reductionTargetPolygonRatio = cmds.SimplygonPipeline(quadReductionPipeline, gs = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio')
print ('ReductionTargetPolygonRatio: ' + str(reductionTargetPolygonRatio) + '\n')

# set the reduction target to ReductionTargetPolygonRatio
bResult = cmds.SimplygonPipeline(quadReductionPipeline, ss = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled', v = True)
reductionTargetPolygonRatioEnabled = cmds.SimplygonPipeline(quadReductionPipeline, gs = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled')
print ('ReductionTargetPolygonRatioEnabled: ' + str(reductionTargetPolygonRatioEnabled) + '\n')

# disable triangle count reduction target
bResult = cmds.SimplygonPipeline(quadReductionPipeline, ss = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled', v = False)
reductionTargetPolygonCountEnabled = cmds.SimplygonPipeline(quadReductionPipeline, gs = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled')
print ('ReductionTargetPolygonCountEnabled: ' + str(reductionTargetPolygonCountEnabled) + '\n')

# disable max deviation reduction target
bResult = cmds.SimplygonPipeline(quadReductionPipeline, ss = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled', v = False)
reductionTargetMaxDeviationEnabled = cmds.SimplygonPipeline(quadReductionPipeline, gs = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled')
print ('ReductionTargetMaxDeviationEnabled: ' + str(reductionTargetMaxDeviationEnabled) + '\n')

# disable onscreensize reduction target
bResult = cmds.SimplygonPipeline(quadReductionPipeline, ss = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled', v = False)
reductionTargetOnScreenSizeEnabled = cmds.SimplygonPipeline(quadReductionPipeline, gs = 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled')
print ('ReductionTargetOnScreenSizeEnabled: ' + str(reductionTargetOnScreenSizeEnabled) + '\n')

# more settings can be set for the Reduction pipeline,
# see Pipeline documentation and/or inspect the generated file
# that is saved out by this script!

# save the generated Pipeline object to file for later use
bResult = cmds.SimplygonPipeline(quadReductionPipeline, s = 'D:/Pipelines/QuadReduction.json')

# clear all pipelines
cmds.SimplygonPipeline(cl = True)

Next steps

Get to know how to use the Reduction Pipeline: