SPL commands

<< Click to Display Table of Contents >>

Navigation:  Simplygon Maya >

SPL commands

SPL (Simplygon Processing Language) is a language used to describe how an asset will be processed. SPL has a one-to-one settings mapping to the Simplygon SDK, please refer to the SDK documentation for information about the individual settings. The purpose of the "SPL" utility is to expose methods for creating and modifying SPL-files through Maya, providing unprecedented flexibility and direct access for all users. The list of script functions below is mentioning output names, these are not the SPL-objects's but the name of the variable/handle that is pointing at the SPL-object. Setting the "Name"-parameter can be done using SetValue and SetString. Note: SPL can only be used when in Batch mode/Silent mode, in any other case, please use preset files.

 

Script Functions

-sf, -SaveFile [output path] [name of spl object]

Saves SPL-object to file.

 

-lf, -LoadFile [input path] [name of output object]

Loads an SPL-file and stores it under the name of the output object.

 

-co, -CreateObject [name of type] [name of output object]

Creates an object of the specified type under the specified name.

 

-do, -DeleteObject [name of object]

Deletes the object associated to the specified name.

 

-sv, -SetValue [name of object] [name of parameter] [value]

Sets the value of the specified object parameter. This function will at first hand try to find an object/handle with the same name to use as a value (created by CreateObject, GetParameter or GetChild), if no objects are found it will be handled as a value type (string, int, double, float)

 

-ss, -SetString [name of object] [name of parameter] [value]

Sets the value of the specified object parameter. This function assumes a value type and will not do an object lookup.

 

-gv, -GetValue [name of object] [name of parameter]

Gets the value of the specified object parameter.

 

-ao, -AddObject [name of object] [name of list parameter] [name of object to add]

Adds an existing object/handle to the specified object's list-parameter.

 

-ro, -RemoveObject [name of object] [name of list parameter] [name of object to remove]

Removes the object from the specified object's list-parameter.

 

-gc, -GetChild [name of object] [name of list parameter] [index] [name of output object]

Gets and stores the object/handle from the specified object's list-parameter.

 

-cl, -ClearList [name of object] [name of list parameter]

Clears the specified object's list parameter.

 

-gp, -GetParameter [name of object] [name of parameter] [name of output object]

Gets and stores the object/handle from the specified object parameter.

 

-c , -Clear

Clears all objects/handles created by CreateObject, GetParameter and GetChild.

 

Reduction Example

SPL -Clear;

SPL -CreateObject SPL sampleReductionSPL;

 

// reduction settings

SPL -CreateObject ReductionSettings reductionSettings;

SPL -SetValue reductionSettings AllowDegenerateTexCoords true

-SetValue reductionSettings CreateGeomorphGeometry false

-SetValue reductionSettings DataCreationPreferences SG_DATACREATIONPREFERENCES_PREFER_OPTIMIZED_RESULT

-SetValue reductionSettings EdgeSetImportance 1.0

-SetValue reductionSettings GenerateGeomorphData false

-SetValue reductionSettings GeometryImportance 1.0

-SetValue reductionSettings GroupImportance 1.0

-SetValue reductionSettings InwardMoveMultiplier 1.0

-SetValue reductionSettings KeepSymmetry false

-SetValue reductionSettings MaterialImportance 1.0

-SetValue reductionSettings MaxDeviation 1.0

-SetValue reductionSettings MaxEdgeLength 2147483647

-SetValue reductionSettings OnScreenSize 300

-SetValue reductionSettings OutwardMoveMultiplier 1.0

-SetValue reductionSettings ProcessSelectionSetName ""

-SetValue reductionSettings ReductionHeuristics SG_REDUCTIONHEURISTICS_CONSISTENT

-SetValue reductionSettings ReductionTargets SG_REDUCTIONTARGET_TRIANGLERATIO

-SetValue reductionSettings ShadingImportance 1.0

-SetValue reductionSettings SkinningImportance 1.0

-SetValue reductionSettings StopCondition SG_STOPCONDITION_ALL

-SetValue reductionSettings SymmetryAxis 4

-SetValue reductionSettings SymmetryDetectionTolerance 0.0004

-SetValue reductionSettings SymmetryOffset 0.0

-SetValue reductionSettings TextureImportance 1.0

-SetValue reductionSettings TriangleCount 1000

-SetValue reductionSettings TriangleRatio 0.5

-SetValue reductionSettings UseAutomaticSymmetryDetection false

-SetValue reductionSettings UseHighQualityNormalCalculation true

-SetValue reductionSettings UseSymmetryQuadRetriangulator true

-SetValue reductionSettings UseVertexWeights true

-SetValue reductionSettings VertexColorImportance 1.0

-SetValue reductionSettings Enabled true;

 

// normal calculation settings

SPL -CreateObject NormalCalculationSettings normalCalculationSettings;

SPL -SetValue normalCalculationSettings DetectPrimitiveNormals false

-SetValue normalCalculationSettings HardEdgeAngleInRadians 1.39626340

-SetValue normalCalculationSettings RepairInvalidNormals false

-SetValue normalCalculationSettings ReplaceNormals false

-SetValue normalCalculationSettings ReplaceTangents false

-SetValue normalCalculationSettings ScaleByAngle true

-SetValue normalCalculationSettings ScaleByArea true

-SetValue normalCalculationSettings Enabled true;

 

// repair settings

SPL -CreateObject RepairSettings repairSettings;

SPL -SetValue repairSettings ProgressivePasses 3

-SetValue repairSettings TjuncDist 0.0

-SetValue repairSettings UseTJunctionRemover false

-SetValue repairSettings UseWelding true

-SetValue repairSettings WeldDist 0.0

-SetValue repairSettings WeldOnlyBorderVertices false

-SetValue repairSettings WeldOnlyObjectBoundary false

-SetValue repairSettings Enabled true;

 

// visibility settings

SPL -CreateObject VisibilitySettings visibilitySettings;

SPL -SetValue visibilitySettings CameraSelectionSetName ""

-SetValue visibilitySettings ConservativeMode false

-SetValue visibilitySettings CullOccludedGeometry false

-SetValue visibilitySettings FillNonVisibleAreaThreshold 0.0

-SetValue visibilitySettings ForceVisibilityCalculation false

-SetValue visibilitySettings OccluderSelectionSetName ""

-SetValue visibilitySettings RemoveTrianglesNotOccludingOtherTriangles true

-SetValue visibilitySettings UseBackfaceCulling true

-SetValue visibilitySettings UseVisibilityWeightsInReducer false

-SetValue visibilitySettings UseVisibilityWeightsInTexcoordGenerator false

-SetValue visibilitySettings VisibilityWeightsPower 1.0

-SetValue visibilitySettings UseCustomVisibilitySphere false

-SetValue visibilitySettings CustomVisibilitySphereFidelity 3

-SetValue visibilitySettings CustomVisibilitySphereYaw 0.0

-SetValue visibilitySettings CustomVisibilitySpherePitch 0.0

-SetValue visibilitySettings CustomVisibilitySphereCoverage 180.0

-SetValue visibilitySettings Enabled false;

 

// bone settings

SPL -CreateObject BoneSettings boneSettings;

SPL -SetValue boneSettings BoneCount 2147483647

-SetValue boneSettings BoneRatio 1.0

-SetValue boneSettings BoneReductionTargets SG_BONEREDUCTIONTARGET_ALL

-SetValue boneSettings LimitBonesPerVertex false

-SetValue boneSettings LockBoneSelectionSetName ""

-SetValue boneSettings MaxBonePerVertex 16

-SetValue boneSettings MaxDeviation 0.0

-SetValue boneSettings OnScreenSize 2147483647

-SetValue boneSettings RemoveUnusedBones false

-SetValue boneSettings RemoveBoneSelectionSetName ""

-SetValue boneSettings Enabled false;

 

// reduction processor

SPL -CreateObject ReductionProcessor reductionProcessor;

SPL -SetValue reductionProcessor ReductionSettings reductionSettings

-SetValue reductionProcessor NormalCalculationSettings normalCalculationSettings

-SetValue reductionProcessor RepairSettings repairSettings

-SetValue reductionProcessor VisibilitySettings visibilitySettings

-SetValue reductionProcessor BoneSettings boneSettings;

 

// process node (assign reduction processor to process node)

SPL -CreateObject ProcessNode processNode;

SPL -SetString processNode Name processNode

-SetValue processNode DefaultTBNType SG_TANGENTSPACEMETHOD_ORTHONORMAL

-SetValue processNode Processor reductionProcessor;

// write node (add to process node)

SPL -CreateObject WriteNode writeNode;

SPL -SetString writeNode Format ssf

-SetString writeNode Name outputlod_0

-AddObject processNode Children writeNode;

 

// container node (add process node to container node)

SPL -CreateObject ContainerNode containerNode;

SPL -SetString containerNode Name containerNode

-AddObject containerNode Children processNode;

 

// assign container node to spl node

SPL -SetValue sampleReductionSPL ProcessGraph containerNode;

Simplygon -b -spl "sampleReductionSPL";

 

Remeshing Example

SPL -Clear;

SPL -CreateObject SPL sampleRemeshingSPL;

 

// remeshing settings

SPL -CreateObject RemeshingSettings remeshingSettings;

SPL -SetValue remeshingSettings CuttingPlaneSelectionSetName ""

-SetValue remeshingSettings HardEdgeAngleInRadians 1.3955555555555557

-SetValue remeshingSettings EmptySpaceOverride 0.0

-SetValue remeshingSettings MaxTriangleSize 0

-SetValue remeshingSettings MergeDistance 4

-SetValue remeshingSettings OnScreenSize 300

-SetValue remeshingSettings ProcessSelectionSetName ""

-SetValue remeshingSettings SurfaceTransferMode SG_SURFACETRANSFER_ACCURATE

-SetValue remeshingSettings TransferColors false

-SetValue remeshingSettings TransferNormals false

-SetValue remeshingSettings UseCuttingPlanes false

-SetValue remeshingSettings UseEmptySpaceOverride false

-SetValue remeshingSettings Enabled true;

 

// mapping image settings

SPL -CreateObject MappingImageSettings mappingImageSettings;

SPL -SetValue mappingImageSettings AllowTransparencyMapping false

-SetValue mappingImageSettings AutomaticTextureSizeMultiplier 1.0

-SetValue mappingImageSettings ChartAggregatorMode SG_CHARTAGGREGATORMODE_SURFACEAREA

-SetValue mappingImageSettings ChartAggregatorOriginalChartProportionsChannel Diffuse

-SetValue mappingImageSettings ChartAggregatorOriginalTexCoordLevel 0

-SetValue mappingImageSettings ChartAggregatorOriginalTexCoordLevelName ""

-SetValue mappingImageSettings ChartAggregatorSeparateOverlappingCharts true

-SetValue mappingImageSettings ForcePower2Texture true

-SetValue mappingImageSettings GenerateMappingImage true

-SetValue mappingImageSettings GenerateTangents true

-SetValue mappingImageSettings GenerateTexCoords true

-SetValue mappingImageSettings GutterSpace 4

-SetValue mappingImageSettings Height 512

-SetValue mappingImageSettings MaximumLayers 3

-SetValue mappingImageSettings MultisamplingLevel 3

-SetValue mappingImageSettings ParameterizerMaxStretch 0.11999999731779099

-SetValue mappingImageSettings TexCoordGeneratorType SG_TEXCOORDGENERATORTYPE_PARAMETERIZER

-SetValue mappingImageSettings TexCoordLevel 255

-SetValue mappingImageSettings UseAutomaticTextureSize false

-SetValue mappingImageSettings UseFullRetexturing false

-SetValue mappingImageSettings UseVertexWeights false

-SetValue mappingImageSettings Width 512

-SetValue mappingImageSettings Enabled true;

 

// visibility settings

SPL -CreateObject VisibilitySettings visibilitySettings;

SPL -SetValue visibilitySettings CameraSelectionSetName ""

-SetValue visibilitySettings ConservativeMode false

-SetValue visibilitySettings CullOccludedGeometry false

-SetValue visibilitySettings FillNonVisibleAreaThreshold 0.0

-SetValue visibilitySettings ForceVisibilityCalculation false

-SetValue visibilitySettings OccluderSelectionSetName ""

-SetValue visibilitySettings RemoveTrianglesNotOccludingOtherTriangles true

-SetValue visibilitySettings UseBackfaceCulling true

-SetValue visibilitySettings UseVisibilityWeightsInReducer false

-SetValue visibilitySettings UseVisibilityWeightsInTexcoordGenerator false

-SetValue visibilitySettings VisibilityWeightsPower 1.0

-SetValue visibilitySettings UseCustomVisibilitySphere false

-SetValue visibilitySettings CustomVisibilitySphereFidelity 3

-SetValue visibilitySettings CustomVisibilitySphereYaw 0.0

-SetValue visibilitySettings CustomVisibilitySpherePitch 0.0

-SetValue visibilitySettings CustomVisibilitySphereCoverage 180.0

-SetValue visibilitySettings Enabled false;

 

// bone settings

SPL -CreateObject BoneSettings boneSettings;

SPL -SetValue boneSettings BoneCount 2147483647

-SetValue boneSettings BoneRatio 1.0

-SetValue boneSettings BoneReductionTargets SG_BONEREDUCTIONTARGET_ALL

-SetValue boneSettings LimitBonesPerVertex false

-SetValue boneSettings LockBoneSelectionSetName ""

-SetValue boneSettings MaxBonePerVertex 16

-SetValue boneSettings MaxDeviation 0.0

-SetValue boneSettings OnScreenSize 2147483647

-SetValue boneSettings RemoveUnusedBones false

-SetValue boneSettings RemoveBoneSelectionSetName ""

-SetValue boneSettings Enabled false;

 

// remeshing processor

SPL -CreateObject RemeshingProcessor remeshingProcessor;

SPL -SetValue remeshingProcessor RemeshingSettings remeshingSettings

-SetValue remeshingProcessor MappingImageSettings mappingImageSettings

-SetValue remeshingProcessor VisibilitySettings visibilitySettings

-SetValue remeshingProcessor BoneSettings boneSettings;

 

// process node (assign reduction processor to process node)

SPL -CreateObject ProcessNode processNode;

SPL -SetString processNode Name processNode

-SetValue processNode DefaultTBNType SG_TANGENTSPACEMETHOD_ORTHONORMAL

-SetValue processNode Processor remeshingProcessor;

 

// ambient color caster

SPL -CreateObject ColorCaster ambientColorCaster;

SPL -SetValue ambientColorCaster BakeOpacityInAlpha false

-SetString ambientColorCaster ColorType Ambient

-SetValue ambientColorCaster Dilation 0

-SetValue ambientColorCaster DitherType SG_DITHERPATTERNS_NO_DITHER

-SetValue ambientColorCaster FillMode SG_ATLASFILLMODE_INTERPOLATE

-SetValue ambientColorCaster OutputChannelBitDepth 8

-SetValue ambientColorCaster OutputChannels 4

-SetValue ambientColorCaster OutputSRGB true

-SetValue ambientColorCaster UseMultisampling true

-SetString ambientColorCaster Name Ambient

-SetString ambientColorCaster Channel Ambient

-SetValue ambientColorCaster Enabled true;

 

// diffuse color caster

SPL -CreateObject ColorCaster diffuseColorCaster;

SPL -SetValue diffuseColorCaster BakeOpacityInAlpha false

-SetString diffuseColorCaster ColorType Diffuse

-SetValue diffuseColorCaster Dilation 0

-SetValue diffuseColorCaster DitherType SG_DITHERPATTERNS_NO_DITHER

-SetValue diffuseColorCaster FillMode SG_ATLASFILLMODE_INTERPOLATE

-SetValue diffuseColorCaster OutputChannelBitDepth 8

-SetValue diffuseColorCaster OutputChannels 4

-SetValue diffuseColorCaster OutputSRGB true

-SetValue diffuseColorCaster UseMultisampling true

-SetString diffuseColorCaster Name Diffuse

-SetString diffuseColorCaster Channel Diffuse

-SetValue diffuseColorCaster Enabled true;

 

// specular color caster

SPL -CreateObject ColorCaster specularColorCaster;

SPL -SetValue specularColorCaster BakeOpacityInAlpha false

-SetString specularColorCaster ColorType Specular

-SetValue specularColorCaster Dilation 0

-SetValue specularColorCaster DitherType SG_DITHERPATTERNS_NO_DITHER

-SetValue specularColorCaster FillMode SG_ATLASFILLMODE_INTERPOLATE

-SetValue specularColorCaster OutputChannelBitDepth 8

-SetValue specularColorCaster OutputChannels 4

-SetValue specularColorCaster OutputSRGB true

-SetValue specularColorCaster UseMultisampling true

-SetString specularColorCaster Name Specular

-SetString specularColorCaster Channel Specular

-SetValue specularColorCaster Enabled true;

 

// normal caster

SPL -CreateObject NormalCaster normalCaster;

SPL -SetValue normalCaster Dilation 0

-SetValue normalCaster DitherType SG_DITHERPATTERNS_NO_DITHER

-SetValue normalCaster FillMode SG_ATLASFILLMODE_INTERPOLATE

-SetValue normalCaster FlipBackfacingNormals false

-SetValue normalCaster FlipGreen false

-SetValue normalCaster GenerateTangentSpaceNormals true

-SetValue normalCaster NormalsChannel SG_MATERIAL_CHANNEL_NORMALS

-SetValue normalCaster OutputChannelBitDepth 8

-SetValue normalCaster OutputChannels 3

-SetString normalCaster Name Normals

-SetString normalCaster Channel Normals

-SetValue normalCaster Enabled true;

 

// append casters to process node

SPL -AddObject processNode MaterialCaster ambientColorCaster

-AddObject processNode MaterialCaster diffuseColorCaster

-AddObject processNode MaterialCaster specularColorCaster

-AddObject processNode MaterialCaster normalCaster;

 

// write node (add to process node)

SPL -CreateObject WriteNode writeNode;

SPL -SetString writeNode Format ssf

-SetString writeNode Name outputlod_0

-AddObject processNode Children writeNode;

 

// container node (add process node to container node)

SPL -CreateObject ContainerNode containerNode;

SPL -SetString containerNode Name containerNode

-AddObject containerNode Children processNode;

 

// assign container node to spl node

SPL -SetValue sampleRemeshingSPL ProcessGraph containerNode;

Simplygon -b -spl "sampleRemeshingSPL";