# 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.
# Syntax
# Flags and args
Short flag | Long flag | Argument(s) | Description |
---|---|---|---|
c | Create | string pipelineType | Creates a pipeline of the specified type. ( ReductionPipeline , AggregationPipeline , RemeshingPipeline ) |
d | Delete | <none> | Deletes the pipeline. |
cl | Clear | <none> | Clears all pipelines that has been loaded or created by Create . |
l | Load | string inputPath | Loads a pipeline-file. |
s | Save | string outputPath | Saves pipeline to file. |
ss | SetSetting | string parameterPath <T> parameterValue | Sets the value of the specified pipeline parameter. ( string , bool , int , double , float ) |
gs | GetSetting | string parameterPath | Gets the value of the specified pipeline parameter. |
v | Value | <T> value | Sets the value of the specified pipeline parameter. Should be used in combination with SetSetting . ( string , bool , int , double , float ) |
t | Type | <none> | Gets the type of the specified pipeline. ( ReductionPipeline , AggregationPipeline , RemeshingPipeline , ...) |
a | All | <none> | Gets all pipeline ids that are loaded or created by Create . |
amc | AddMaterialCaster | string casterType | Adds a material-caster to the specified pipeline. ( ColorCaster , NormalCaster , ...) |
acp | AddCascadedPipeline | int pipelineToAdd | Adds a cascaded pipeline to the specified 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
, other supported pipelines are AggregationPipeline
, RemeshingPipeline
and RemeshingV2Pipeline
.
# 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.
# 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.
# Get / Set Pipeline settings
Currently we support four Pipelines: ReductionPipeline
, AggregationPipeline
, RemeshingPipeline
and RemeshingLegacyPipeline
. These Pipelines can be created by the c
-flag (Create
) in combination with the type name of the Pipeline.
Each Pipeline has settings which reflects the settings for the specific Processor in the Simplygon API. ReductionPipeline contains a ReductionProcessor which contains ReductionSettings while for example the RemeshingProcessor has RemeshingSettings.
MaterialCaster
is a separate object that is located inside the Pipelines, which contains the 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).
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.
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).
# Next steps
For more information about Pipelines, visit the links below.
Pipeline (API) documentation