# Pipeline LOD-chain (based on original asset)
This example executes Simplygon three times in a loop, where each optimization (in this case Reduction
) is based on the original asset. This is accomplished by simply overriding the ReductionTargetTriangleRatio
each loop before sending the asset off to Simplygon.
// load an asset
file -f -options "v=0;" -ignoreVersion -typ "mayaBinary" -o "D:/Assets/SomeAsset.mb";
// select everything in scene
select -all;
// load previously saved pipeline
$reductionPipeline = `SimplygonPipeline -l "D:/Pipelines/reductionPipeline.json"`;
// override triangle ratio to 100%
$bResult = `SimplygonPipeline -ss "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" -v 1.0 $reductionPipeline`;
// loop 3 times,
// 1 - reduce original asset to 100 - 25 = 75% (LOD1)
// 2 - reduce original asset to 75 - 25 = 50% (LOD2)
// 3 - reduce original asset to 50 - 25 = 25% (LOD3)
for( $i = 0; $i < 3; ++$i )
{
// fetch current triangle ratio
$reductionTargetTriangleRatio = `SimplygonPipeline -gs "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" $reductionPipeline`;
// subtract triangle ratio by 25%
$bResult = `SimplygonPipeline -ss "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" -v ($reductionTargetTriangleRatio - 0.25) $reductionPipeline`;
// execute pipeline on selection,
// returns result to Maya once completed
Simplygon -so $reductionPipeline;
}
// clear all pipelines
SimplygonPipeline -cl;