Skip to content
On this page

SimplygonPipeline command

Description

The SimplygonPipeline command is responsible for creating, modifying, importing and exporting of Pipelines / settings. It is recommended to read Pipeline concepts before proceeding.

Supported Pipelines

Pipeline (API)ComponentsLevel of supportDescription
ReductionPipelineReductionProcessor
MaterialCaster
Almost completeReduces the geometries
Possibility to maintain original materials
Possibility to bake materials
AggregationPipelineAggregationProcessor
MaterialCaster
Almost completeAggregates / combines geometries
Possibility to maintain original materials
Possibility to bake materials
RemeshingPipelineRemeshingProcessor
MaterialCaster
Almost completeCreates a replacement geometry
Can not preserve original materials
Possibility to bake materials
BillboardCloudPipelineImpostorProcessor
MaterialCaster
GoodCreates multiple static billboards (outer shell)
Possibility to bake materials
BillboardCloudVegetationPipelineImpostorProcessor
MaterialCaster
GoodCreates multiple static billboards (within volume) within a threshold
Can maintain original material in certain areas
Possibility to bake materials
FlipbookPipelineImpostorProcessor
MaterialCaster
PendingCreates a single replacement billboard to be used from multiple directions
Possibility to bake materials
ImpostorFromSingleViewPipelineImpostorProcessor
MaterialCaster
Almost completeCreates a single replacement billboard to be used from a specific view direction
Possibility to bake materials
PassthroughPipelineAlmost completeThis pipeline itself does not generate any result, but allows the user to add other pipelines as children (cascaded pipelines). All first level children of this node will be based on the same input.

Syntax

MEL
SimplygonPipeline -<short/long flag> <arg0> <arg1> ... <argN>;
python
import maya.cmds as cmds
cmds.SimplygonPipeline(<short/long flag>=<arg>)
cmds.SimplygonPipeline(<short/long flag>=[<arg0>, <arg1>, ..., <argN>])

Flags and arguments

Short flagLong flagArgument(s)Description
cCreatestring pipelineTypeCreates a pipeline of the specified type.
(see supported pipelines)
clnClone<none>Clones the pipeline (created by Create or Load).
dDelete<none>Deletes the pipeline (created by Create or Load).
clClear<none>Clears all pipelines (created by Create or Load).
lLoadstring inputPathLoads a pipeline-file.
sSavestring outputPathSaves pipeline to file (created by Create or Load).
ssSetSettingstring parameterPath
<T> parameterValue
Sets the value of the specified pipeline parameter.
(string, bool, int, double, float)
gsGetSettingstring parameterPathGets the value of the specified pipeline parameter.
vValue<T> valueSets the value of the specified pipeline parameter. Should be used in combination with SetSetting.
(string, bool, int, double, float)
tType<none>Gets the type of the specified pipeline.
(see supported pipelines)
aAll<none>Gets all pipeline ids that are loaded or created by Create.
amcAddMaterialCasterstring casterTypeAdds a material-caster to the specified pipeline.
(ColorCaster, NormalCaster, ...)
acpAddCascadedPipelineint pipelineToAddAdds a cascaded pipeline to the specified pipeline.
gcpGetCascadedPipelineint childIndexGets the child handle of the specified pipeline.
gccGetCascadedPipelineCount<none>Gets the child count of the specified pipeline.
gmcGetMaterialCasterCount<none>Gets the number of material casters for the given pipeline.
gmtGetMaterialCasterTypeint materialCasterIndexGets the type of the material caster for the given pipeline.

Examples

This section contains various Pipeline examples written in MEL and Python. We've left out some parts of the scripts to keep things as simple as possible.

  • import maya.cmds as cmds must be declared at the top of each Python script.
  • reductionPipeline settings-path must be declared for both MEL and Python scripts where it makes sense.
  • a scene-selection is made before each Simplygon-command.

Create a Pipeline object

Creates a ReductionPipeline, see supported pipelines for more information.

MEL
$reductionPipeline = `SimplygonPipeline -c "ReductionPipeline"`;
python
reductionPipeline = cmds.SimplygonPipeline(c = 'ReductionPipeline')

Load / save a Pipeline object

Loads a Pipeline object from file and then saves it.

Note: Pipeline files should only be used as intermediate and are not intended to be used as presets or templates. Pipeline files are not guaranteed to be compatible with different versions of Simplygon. It is recommended to script Pipelines that saves out Pipeline files rather than loading Pipelines from file.

MEL
$reductionPipeline = `SimplygonPipeline -l "D:/Pipelines/reductionPipeline.json"`;
$bResult = `SimplygonPipeline -s "D:/Pipelines/reductionPipeline.json" $reductionPipeline`;
python
reductionPipeline = cmds.SimplygonPipeline(l = 'D:/Pipelines/reductionPipeline.json')
bResult = cmds.SimplygonPipeline(reductionPipeline, s = 'D:/Pipelines/reductionPipeline.json')

Clone a Pipeline object

Clones a ReductionPipeline.

MEL
$reductionPipeline = `SimplygonPipeline -l "D:/Pipelines/reductionPipeline.json"`;
$clonedReductionPipeline = `SimplygonPipeline -cln $reductionPipeline`;
python
reductionPipeline = cmds.SimplygonPipeline(l = 'D:/Pipelines/reductionPipeline.json')
clonedReductionPipeline = cmds.SimplygonPipeline(reductionPipeline, cln = True)

Cascaded Pipelines (LOD-chain)

Cascaded pipelines means that each LOD is based on the previous LOD, instead of the original asset which is the standard behavior. In this example we will load two pipelines, one with reduction (LOD1) and one with reduction and baking (LOD2). LOD1 will be based on the original asset and LOD2 will be based on LOD1.

If cascaded pipelines are used in combination with processing from/to file the output scene names will be appended with "_LOD" prefix and then indexed from 1 to *, where the index increments for each cascaded level. The output texture folder for each cascaded scene will be "Textures/LOD1" for LOD1, "Textures/LOD2" for LOD2 and so on. The output file names can be fetched with GetProcessedOutputPaths (gpp) which can then be used at import.

Creates cascaded Pipelines.

MEL
// loads two different pipelines
$reductionPipeline = `SimplygonPipeline -l "D:/Pipelines/reductionPipeline.json"`;
$reductionPipelineWithBaking = `SimplygonPipeline -l "D:/Pipelines/reductionPipelineWithBaking.json"`;

// adds reduction with baking as cascaded pipeline using AddCascadedPipeline
$bResult = `SimplygonPipeline -acp $reductionPipelineWithBaking $reductionPipeline`;

// save new cascaded pipeline to disk
$bResult = `SimplygonPipeline -s "D:/Pipelines/cascadedReductionPipeline.json" $reductionPipeline`;
python
# loads two different pipelines
reductionPipeline = cmds.SimplygonPipeline(l = 'D:/Pipelines/reductionPipeline.json')
reductionPipelineWithBaking = cmds.SimplygonPipeline(l = 'D:/Pipelines/reductionPipelineWithBaking.json')

# adds reduction with baking as cascaded pipeline using AddCascadedPipeline
bResult = cmds.SimplygonPipeline(reductionPipeline, acp = reductionPipelineWithBaking)

# save new cascaded pipeline to disk
bResult = cmds.SimplygonPipeline(reductionPipeline, s = 'D:/Pipelines/cascadedReductionPipeline.json')

Get / Set Pipeline settings

Pipelines can be created using the SimplygonPipeline's create-flag (c) and the type of the Pipeline to be created. A Pipeline contain settings which reflects the settings for the specific Processor in the Simplygon API. A ReductionPipeline contains a ReductionProcessor which contain ReductionSettings.

MaterialCaster is a separate object resides inside Pipelines The MaterialCaster object contains settings for material baking.

To set a reduction setting for a ReductionPipeline, let's say ReductionTargetTriangleRatio, we will have to pinpoint the path to the specific setting. SimplygonPipeline is the command we use to work with settings, to set a setting we use the ss-flag (SetSetting). The first input is the Pipeline-object, the second is the settings-path and the third is the value we want to set. Fetching a value of a setting works the same way, except that it returns the value of the given settings-path instead of setting it, the flag for fetching a settings value is gs (GetSetting).

A settings-path can start with a Processor, MaterialCaster, or any other first level object. In this case we want to set a setting in the ReductionProcessor, which is the first part of the path, the second part is the settings-object which in this case is ReductionSettings. And at last, the parameter we want to set is named ReductionTargetTriangleRatio. Let's set the value of ReductionTargetTriangleRatio to 50% (0.5).

MEL
// sets the ReductionTargetTriangleRatio for the given ReductionPipeline
$bResult = `SimplygonPipeline -ss "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" -v 0.5 $reductionPipeline`;

// gets the ReductionTargetTriangleRatio from the given ReductionPipeline
$reductionTargetTriangleRatio = `SimplygonPipeline -gs "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" $reductionPipeline`;
python
# sets the ReductionTargetTriangleRatio for the given ReductionPipeline
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio', v = 0.5)

# gets the ReductionTargetTriangleRatio from the given ReductionPipeline
reductionTargetTriangleRatio = cmds.SimplygonPipeline(reductionPipeline, gs = 'ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio')

The same goes for TextureWidth and TextureHeight, which are part of the MappingImage settings-object. In most cases we only use one mapping image, thus Output0 which is allocated by default. Let's set them to 512x512 pixels.

MEL
// sets the texture-width for the given ReductionPipeline
$bResult = `SimplygonPipeline -ss "ReductionProcessor/MappingImageSettings/Output0/TextureWidth" -v 512 $reductionPipeline`;

// gets the texture-width for the given ReductionPipeline
$textureWidth = `SimplygonPipeline -gs "ReductionProcessor/MappingImageSettings/Output0/TextureWidth" $reductionPipeline`;

// sets the texture-height for the given ReductionPipeline
$bResult = `SimplygonPipeline -ss "ReductionProcessor/MappingImageSettings/Output0/TextureHeight" -v 512 $reductionPipeline`;

// gets the texture-height for the given ReductionPipeline
$textureHeight = `SimplygonPipeline -gs "ReductionProcessor/MappingImageSettings/Output0/TextureHeight" $reductionPipeline`;
python
# sets the texture-width for the given ReductionPipeline
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'ReductionProcessor/MappingImageSettings/Output0/TextureWidth', v =  512)

# gets the texture-width for the given ReductionPipeline
textureWidth = cmds.SimplygonPipeline(reductionPipeline, gs = 'ReductionProcessor/MappingImageSettings/Output0/TextureWidth')

# sets the texture-height for the given ReductionPipeline
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'ReductionProcessor/MappingImageSettings/Output0/TextureHeight', v = 512)

# gets the texture-height for the given ReductionPipeline
textureHeight = cmds.SimplygonPipeline(reductionPipeline, gs = 'ReductionProcessor/MappingImageSettings/Output0/TextureHeight')

For material baking the initial object is MaterialCaster, and as there aren't any casters by default they will have to be created with the amc (AddMaterialCaster) flag. There after we can use the index and settings of the caster to access its parameters.

Note: The material channels for the MaterialCaster in this example are intended for standard materials in Maya such as Blinn, Phong and Lambert, and might not work for other materials. Additional channels such as incandescence and transparency can be added for baking, for incandescence the ColorCaster is recommended, for transparency the OpacityCaster is recommended (for correct baking of transparent surfaces).

MEL
// add a ColorCaster to the given ReductionPipeline
$bCasterAdded = `SimplygonPipeline -amc "ColorCaster" $reductionPipeline`;

// set the MaterialChannel to "color" for the given ColorCaster
$bResult = `SimplygonPipeline -ss "MaterialCaster/0/ColorCasterSettings/MaterialChannel" -v "color" $reductionPipeline`;

// get the MaterialChannel for the given ColorCaster
$colorCaster0 = `SimplygonPipeline -gs "MaterialCaster/0/ColorCasterSettings/MaterialChannel" $reductionPipeline`;

// add a NormalCaster to the given ReductionPipeline
$bCasterAdded = `SimplygonPipeline -amc "NormalCaster" $reductionPipeline`;

// set the MaterialChannel to "normalCamera" for the given NormalCaster
$bResult = `SimplygonPipeline -ss "MaterialCaster/1/NormalCasterSettings/MaterialChannel" -v "normalCamera" $reductionPipeline`;

// get the MaterialChannel for the given NormalCaster
$normalCaster1 = `SimplygonPipeline -gs "MaterialCaster/1/NormalCasterSettings/MaterialChannel" $reductionPipeline`;

// set the tangent-space flag for the given NormalCaster
$bResult = `SimplygonPipeline -ss "MaterialCaster/1/NormalCasterSettings/GenerateTangentSpaceNormals" -v true $reductionPipeline`;

// get the tangent-space flag for the given NormalCaster
$generateTangentSpaceNormals = `SimplygonPipeline -gs "MaterialCaster/1/NormalCasterSettings/GenerateTangentSpaceNormals" $reductionPipeline`;
python
# add a ColorCaster to the given ReductionPipeline
bCasterAdded = cmds.SimplygonPipeline(reductionPipeline, amc = 'ColorCaster')

# set the MaterialChannel to 'color' for the given ColorCaster
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'MaterialCaster/0/ColorCasterSettings/MaterialChannel', v = 'color')

# get the MaterialChannel for the given ColorCaster
colorCaster0 = cmds.SimplygonPipeline(reductionPipeline, gs = 'MaterialCaster/0/ColorCasterSettings/MaterialChannel')

# add a NormalCaster to the given ReductionPipeline
bCasterAdded = cmds.SimplygonPipeline(reductionPipeline, amc = 'NormalCaster')

# set the MaterialChannel to 'normalCamera' for the given NormalCaster
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'MaterialCaster/1/NormalCasterSettings/MaterialChannel', v = 'normalCamera')

# get the MaterialChannel for the given NormalCaster
normalCaster1 = cmds.SimplygonPipeline(reductionPipeline, gs = 'MaterialCaster/1/NormalCasterSettings/MaterialChannel')

# set the tangent-space flag for the given NormalCaster
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'MaterialCaster/1/NormalCasterSettings/GenerateTangentSpaceNormals', v = True)

# get the tangent-space flag for the given NormalCaster
generateTangentSpaceNormals = cmds.SimplygonPipeline(reductionPipeline, gs = 'MaterialCaster/1/NormalCasterSettings/GenerateTangentSpaceNormals')

Cascaded Pipeline settings

Cascaded pipelines are pipelines that depends on other pipelines, let's say that you want to create two LODs where the second LOD (child) uses the first LOD (parent) as reference when optimizing.

If we wish to update a setting deeper down in the hierarchy of pipelines we can use the Cascaded keyword followed by the index of the child Pipeline, then use the regular settings path for the target pipeline.

Below is an example on how to get / set the TriangleRatio for the first child of the Pipeline, let's assume that the first child is a ReductionPipeline.

MEL
// sets the ReductionTargetTriangleRatio for the given ReductionPipeline
$bResult = `SimplygonPipeline -ss "Cascaded/0/ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" -v 0.5 $reductionPipeline`;

// gets the ReductionTargetTriangleRatio from the given ReductionPipeline
$reductionTargetTriangleRatio = `SimplygonPipeline -gs "Cascaded/0/ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" $reductionPipeline`;
python
# sets the ReductionTargetTriangleRatio for the given ReductionPipeline
bResult = cmds.SimplygonPipeline(reductionPipeline, ss = 'Cascaded/0/ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio', v = 0.5)

# gets the ReductionTargetTriangleRatio from the given ReductionPipeline
reductionTargetTriangleRatio = cmds.SimplygonPipeline(reductionPipeline, gs = 'Cascaded/0/ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio')

We also provide helper flags for fetching the pipeline handle of a cascaded pipeline (first level). This handle is identical to the handle returned by create and load and can be used in same way.

MEL
// loads cascaded pipelines from file
$pipeline = `SimplygonPipeline -l "D:/Pipelines/cascadedPipeline.json"`;

// get child count
$cascadedPipelineCount = `SimplygonPipeline -gcc $pipeline`;

// get child handles
for($i = 0; $i < $cascadedPipelineCount; ++$i)
{
    $cascadedPipeline = `SimplygonPipeline -gcp $i $pipeline`;
    $cascadedPipelineType = `SimplygonPipeline -t $cascadedPipeline`;
}
python
# loads cascaded pipelines from file
pipeline = cmds.SimplygonPipeline(l = 'D:/Pipelines/cascadedPipeline.json')

# get child count
cascadedPipelineCount = cmds.SimplygonPipeline(pipeline, gcc = True)

# get child handles
for i in range(cascadedPipelineCount):
    cascadedPipeline = cmds.SimplygonPipeline(pipeline, gcp = i)
    cascadedPipelineType = cmds.SimplygonPipeline(cascadedPipeline, t = True)

Cascaded Pipelines

Use "GetCascadedPipelineCount" to detect if there are cascaded pipelines and take the appropriate actions. If an error pops up that states that a setting does not exist when trying to read or write values then the pipeline(s) might be structured in a cascaded approach, thus the need to update the setting paths or loop each pipeline individually.

An example of where the pipeline structure might be confusing is when creating pipelines on the same level in the Simplygon UI, all LODs will be based on the original asset and not the previous LOD. In this case we automatically create something called a PassthroughPipeline and then hook in the pipelines specified in the UI as children. So technically this means that there is a hierarchy of pipelines, therefor cascaded and should be treated as such when accessing settings.

Query material caster settings

In some cases you may want to know the number of material casters, specific settings or simply the type or name of the caster. Below is a short script demonstrating how to list available material casters in a pipeline as well as querying settings. This example is utilizing GetMaterialCasterCount (gmc) and GetMaterialCasterType (gmt) to construct a valid settings path to be used as argument for the GetSetting (gs) flag.

MEL
// load a pipeline
$pipelineId = `SimplygonPipeline -l "D:\\Pipelines\\AggregationWithBaking.json"`;

// fetch the total number of material casters in pipeline
int $numCasters = `SimplygonPipeline -GetMaterialCasterCount $pipelineId`;

// for each material caster
for ($casterIndex = 0; $casterIndex < $numCasters; $casterIndex++)
{
    // fetch the type (for example ColorCaster, NormalCaster)
    string $casterType = `SimplygonPipeline -GetMaterialCasterType $casterIndex $pipelineId`;
    print ("\n" + $casterType);

    // construct a settings path to the material channel name,
    // "MaterialCaster/0/ColorCasterSettings/MaterialChannel"
    // "MaterialCaster/1/NormalCasterSettings/MaterialChannel"
    string $settingsPath = ("MaterialCaster/" + $casterIndex + "/" + $casterType + "Settings/MaterialChannel"); 
    
    // fetch the setting
    string $channelName = `SimplygonPipeline -gs $settingsPath $pipelineId`;
    print ("\n\t" + $channelName);
}
python
# load a pipeline
pipelineId = cmds.SimplygonPipeline(l = 'D:\\Pipelines\\AggregationWithBaking.json')

# fetch the total number of material casters in pipeline
numCasters = cmds.SimplygonPipeline(pipelineId, GetMaterialCasterCount = True)

# for each material caster
for casterIndex in range(numCasters):
    # fetch the type (for example ColorCaster, NormalCaster)
    casterType = cmds.SimplygonPipeline(pipelineId, GetMaterialCasterType = casterIndex)
    print ('\n' + casterType)

    # construct a settings path to the material channel name,
    # 'MaterialCaster/0/ColorCasterSettings/MaterialChannel'
    # 'MaterialCaster/1/NormalCasterSettings/MaterialChannel'
    settingsPath = ('MaterialCaster/' + str(casterIndex) + '/' + casterType + 'Settings/MaterialChannel')
    
    # fetch the setting
    channelName = cmds.SimplygonPipeline(pipelineId, gs = settingsPath)
    print ('\n\t' + channelName)

Multiple LODs based on the same source (using PassthroughPipeline)

Generating multiple LODs that are based on the same source can be achieved quite easily. The first (and most commonly used method) is to simply run Simplygon multiple times on the same asset, but there is always some amount of overhead transfering data back and forth.

Another more efficient way is to set up cascaded pipelines and generate all LODs in one single call. This can be achieved using the PassthroughPipeline which purpose is to offer the user to hook up multiple child pipelines to one single source, the PassthroughPipeline itself does not generate any result. All first level children of the PassthroughPipeline will be based on the same input source.

MEL
// create a passthrough pipeline
$passthroughPipelineId = `SimplygonPipeline -c "PassthroughPipeline"`;

// create a reduction pipeline and set target triangle ratio to 50%
$reductionPipelineId_1 = `SimplygonPipeline -c "ReductionPipeline"`;
SimplygonPipeline -ss "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" -v 0.50 $reductionPipelineId_1;

// create a second reduction pipeline and set target triangle ratio to 25%
$reductionPipelineId_2 = `SimplygonPipeline -c "ReductionPipeline"`;
SimplygonPipeline -ss "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" -v 0.25 $reductionPipelineId_2;

// hook reduction pipelines up to passthrough pipeline,
// note: both results will be based on original asset!
SimplygonPipeline -acp $reductionPipelineId_1 $passthroughPipelineId;
SimplygonPipeline -acp $reductionPipelineId_2 $passthroughPipelineId;

// run Simplygon
Simplygon -so $passthroughPipelineId -mnf "{MeshName}_LOD{LODIndex}";
python
import maya.cmds as cmds

# create a passthrough pipeline
passthroughPipelineId = cmds.SimplygonPipeline(c = 'PassthroughPipeline')

# create a reduction pipeline and set target triangle ratio to 50%
reductionPipelineId_1 = cmds.SimplygonPipeline(c = 'ReductionPipeline')
cmds.SimplygonPipeline(reductionPipelineId_1, ss = 'ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio', v = 0.50)

# create a second reduction pipeline and set target triangle ratio to 25%
reductionPipelineId_2 = cmds.SimplygonPipeline(c = 'ReductionPipeline')
cmds.SimplygonPipeline(reductionPipelineId_2, ss = 'ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio', v = 0.25)

# hook reduction pipelines up to passthrough pipeline,
# note: both results will be based on original asset!
cmds.SimplygonPipeline(passthroughPipelineId, acp = reductionPipelineId_1)
cmds.SimplygonPipeline(passthroughPipelineId, acp = reductionPipelineId_2)

# run Simplygon
cmds.Simplygon(so = passthroughPipelineId, mnf = '{MeshName}_LOD{LODIndex}')