Simplygon functions

<< Click to Display Table of Contents >>

Navigation:  Simplygon Max >

Simplygon functions

The Max plugin exports a number of global MAXScript functions. To run Simplygon from the MAXScript Listener, select the objects you want to process, bring up the MAXScript Listener and run the function "sgsdk_ProcessSelectedGeometries()".

Below is a complete list of the supported commands:

(NOTE: parameters [attribute] should be replaced with the corresponding attribute)

{[string ChannelName] -> "Diffuse"}

{[bool flag] -> true}

{[float r] -> 1.0)}

sgsdk_ProcessSelectedGeometries ()

Process the currently selected geometries (generates the LODs).

 

sgsdk_Reset ()

Resets all current settings in the Max plugin.

sgsdk_setShowProgress [bool flag]

Sets the ShowProgress flag. If set, the process runs in its own thread with a progress bar.

showprogress

Figure 3: The progress bar that is displayed when ShowProgress is set to true.

 

sgsdk_SetSettingsPath [string settingspath]

Sets the path to the preset/SPL which will be used when processing.

Note: SPL files are only allowed in combination with batch mode.

 

sgsdk_SetLoginInfo [string username] [string password]

Sets the login information which is required when in batch mode.

 

sgsdk_setBatchMode [bool flag]

Sets the BatchMode flag. If true, the process will run with the current settings without

opening the GUI. Make sure to set the login information before processing.

 

sgsdk_getBatchMode ()

Gets the BatchMode flag.

 

sgsdk_MaterialColor [string materialname] [string channelname] [float r] [float g] [float b] [float a]

Overrides or creates a color on the specified channel for the specified material.

 

sgsdk_MaterialTexture [string materialname] [string channelname] [string texturepath]

Overrides the texture for the specified material.

 

sgsdk_MaterialTextureMapChannel [string materialname] [string channelname] [int mapchannel]

Overrides the map/uv channel for the specified material.

 

sgsdk_SetIsVertexColorChannel[int maxchannel] [bool is_vertexcolor]

Overrides channels > 2 in Max to be used as vertex colors instead of uv coords.

 

sgsdk_SetLockOnBone [string bonename] [bool lock]

If lock is true, the specified bone and its parents will be locked during bone reduction.

 

sgsdk_CustomShaderChannelOverride [string materialname] [string materialchannel] [string simplygonchannel]

Maps DX Material Channel to Simplygon Channel.

 

sgsdk_UseNonConflictingTextureNames [bool usematerialcolor]

Override generation of Unique Texture names per object when a MaterialLOD is created. By default the value is set to true.

 

sgsdk_SetUseColorChannelAsWeights [int maxchannel] [bool removeField]

The specified channel (where channel > 2) is used as vertex weights. Set removeField to true if the channel should not be exported to Simplygon. Disable by setting the channel to -1.

 

sgsdk_SetWeightsMultiplier [int multiplier]

Sets the weight multiplier. The lower bound of the weights is (1/multiplier) and the bound is (multiplier). The multiplier must be in the range 2-8.

 

sgsdk_SetWeightsInterpreter [int interpreter]

Sets which interpreter to use when interpreting vertex colors as weights.

0: Black: reduce more | White: reduce less (Default)

1: Black: unchanged | White: reduce less

2: Black: reduce more | White: unchanged

 

sgsdk_GetTexturePathForCustomChannel [string materialname]

Gets texture path for specified material channel, if exists.

 

sgsdk_GetMaterialsWithCustomChannels ()

Gets a list of materials that has custom channels.

 

sgsdk_GetCustomChannelsForMaterial [string materialname]

Gets a list of custom channels for the specified material.

 

sgsdk_SetTextureOutputDirectory [string outputdirectory]

Sets the output directory for the generated textures.

 

sgsdk_UseSPL [string object]

Specifies which SPL object to use (created with spl_Create).

 

Examples

The examples below shows how to use Simplygon through MaxScript.

 

Starting the Simplygon Editor

This MaxScript will send over the selected object to the Simplygon GUI and open it with the basic settings.

sgsdk_Reset();

sgsdk_ProcessSelectedGeometries ();

 

Starting Simplygon in batch mode

This MaxScript will send over the selected object to the Simplygon Batch Processor for processing and return the processed objects when completed.

sgsdk_Reset();

sgsdk_SetLoginInfo "username" "password";

sgsdk_SetSettingsPath "c:/MyPreset.preset";

sgsdk_setBatchMode true;

sgsdk_ProcessSelectedGeometries ();

 

Lock bone/bones during process

This MaxScript will send over the selected object to the Simplygon GUI with the specified bones marked as locked and will hence not be removed during BoneLOD.

sgsdk_Reset();

sgsdk_SetLockOnBone "skeleton1_LeftForeArm" true;

sgsdk_ProcessSelectedGeometries ();

The next MaxScript will send over the selected object but instead lock multiple bones.

sgsdk_Reset();

boneList = #($skeleton1_LeftForeArm, $skeleton1_RightFoot)

for boneName in boneList do (

 sgsdk_SetLockOnBone boneName.name true

)

sgsdk_ProcessSelectedGeometries ();

 

Using vertex colors

This script will start a processing in batch mode based on the settings stored in "MyPreset.preset". Channel 3 will be overridden to be handled as a vertex color channel and channel 4 will be used as vertex weights with a multiplier of 8. The result will return to Max when the processing is complete.

sgsdk_Reset();

sgsdk_SetLoginInfo "username" "password";

sgsdk_SetSettingsPath "c:/MyPreset.preset";

sgsdk_setBatchMode true;

sgsdk_SetIsVertexColorChannel 3 true

sgsdk_SetUseColorChannelAsWeights 4 true

sgsdk_SetWeightsultiplier 8

sgsdk_ProcessSelectedGeometries ();

 

SPL Functions

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 functions is to expose methods for creating and modifying SPL-files through Max, 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.

 

spl_Save [string splobject] [string outputpath]

Saves SPL-object to file.

 

spl_Load [string splobject] [string inputpath] [string outputobject]

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

 

spl_Create [string type] [string outputobject]

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

 

spl_Delete [string object]

Deletes the object associated to the specified name.

 

spl_Set [string object] [string 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)

 

spl_SetString [string object] [string parameter] [string value]

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

 

spl_Get [string object] [string parameter]

Gets the value of the specified object parameter.

 

spl_Add [string object] [string listparameter] [string object_to_add]

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

 

spl_Remove [string object] [string listparameter] [string object_to_remove]

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

 

spl_GetChild [string object] [string parameter] [index] [string outputobject]

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

 

spl_ClearList [string object] [string listparameter]

Clears the specified object's list parameter.

 

spl_GetParameter [string object] [string parameter] [string outputobject]

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

 

spl_Clear

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

 

Examples

This section include examples on how to setup SPL.

 

Reduction

sampleReductionSPL = spl_Create "SPL" "sampleReductionSPL"

 

-- reduction settings

spl_Create "ReductionSettings" "reductionSettings"

spl_Set "reductionSettings" "AllowDegenerateTexCoords" true

spl_Set "reductionSettings" "CreateGeomorphGeometry" false

spl_Set "reductionSettings" "DataCreationPreferences" "SG_DATACREATIONPREFERENCES_PREFER_OPTIMIZED_RESULT"

spl_Set "reductionSettings" "EdgeSetImportance" 1.0

spl_Set "reductionSettings" "GenerateGeomorphData" false

spl_Set "reductionSettings" "GeometryImportance" 1.0

spl_Set "reductionSettings" "GroupImportance" 1.0

spl_Set "reductionSettings" "InwardMoveMultiplier" 1.0

spl_Set "reductionSettings" "KeepSymmetry" false

spl_Set "reductionSettings" "MaterialImportance" 1.0

spl_Set "reductionSettings" "MaxDeviation" 1.0

spl_Set "reductionSettings" "MaxEdgeLength" 2147483647

spl_Set "reductionSettings" "OnScreenSize" 300

spl_Set "reductionSettings" "OutwardMoveMultiplier" 1.0

spl_Set "reductionSettings" "ProcessSelectionSetName" ""

spl_Set "reductionSettings" "ReductionHeuristics" "SG_REDUCTIONHEURISTICS_CONSISTENT"

spl_Set "reductionSettings" "ReductionTargets" "SG_REDUCTIONTARGET_TRIANGLERATIO"

spl_Set "reductionSettings" "ShadingImportance" 1.0

spl_Set "reductionSettings" "SkinningImportance" 1.0

spl_Set "reductionSettings" "StopCondition" "SG_STOPCONDITION_ALL"

spl_Set "reductionSettings" "SymmetryAxis" 4

spl_Set "reductionSettings" "SymmetryDetectionTolerance" 0.0004

spl_Set "reductionSettings" "SymmetryOffset" 0.0

spl_Set "reductionSettings" "TextureImportance" 1.0

spl_Set "reductionSettings" "TriangleCount" 1000

spl_Set "reductionSettings" "TriangleRatio" 0.5

spl_Set "reductionSettings" "UseAutomaticSymmetryDetection" false

spl_Set "reductionSettings" "UseHighQualityNormalCalculation" true

spl_Set "reductionSettings" "UseSymmetryQuadRetriangulator" true

spl_Set "reductionSettings" "UseVertexWeights" true

spl_Set "reductionSettings" "VertexColorImportance" 1.0

spl_Set "reductionSettings" "Enabled" true

 

-- normal calculation settings

spl_Create "NormalCalculationSettings" "normalCalculationSettings"

spl_Set "normalCalculationSettings" "DetectPrimitiveNormals" false

spl_Set "normalCalculationSettings" "HardEdgeAngleInRadians" 1.39626340

spl_Set "normalCalculationSettings" "RepairInvalidNormals" false

spl_Set "normalCalculationSettings" "ReplaceNormals" false

spl_Set "normalCalculationSettings" "ReplaceTangents" false

spl_Set "normalCalculationSettings" "ScaleByAngle" true

spl_Set "normalCalculationSettings" "ScaleByArea" true

spl_Set "normalCalculationSettings" "Enabled" true

 

-- repair settings

spl_Create "RepairSettings" "repairSettings"

spl_Set "repairSettings" "ProgressivePasses" 3

spl_Set "repairSettings" "TjuncDist" 0.0

spl_Set "repairSettings" "UseTJunctionRemover" false

spl_Set "repairSettings" "UseWelding" true

spl_Set "repairSettings" "WeldDist" 0.0

spl_Set "repairSettings" "WeldOnlyBorderVertices" false

spl_Set "repairSettings" "WeldOnlyObjectBoundary" false

spl_Set "repairSettings" "Enabled" true

 

-- visibility settings

spl_Create "VisibilitySettings" "visibilitySettings"

spl_Set "visibilitySettings" "CameraSelectionSetName" ""

spl_Set "visibilitySettings" "ConservativeMode" false

spl_Set "visibilitySettings" "CullOccludedGeometry" false

spl_Set "visibilitySettings" "FillNonVisibleAreaThreshold" 0.0

spl_Set "visibilitySettings" "ForceVisibilityCalculation" false

spl_Set "visibilitySettings" "OccluderSelectionSetName" ""

spl_Set "visibilitySettings" "RemoveTrianglesNotOccludingOtherTriangles" true

spl_Set "visibilitySettings" "UseBackfaceCulling" true

spl_Set "visibilitySettings" "UseVisibilityWeightsInReducer" false

spl_Set "visibilitySettings" "UseVisibilityWeightsInTexcoordGenerator" false

spl_Set "visibilitySettings" "VisibilityWeightsPower" 1.0

spl_Set "visibilitySettings" "UseCustomVisibilitySphere" false

spl_Set "visibilitySettings" "CustomVisibilitySphereFidelity" 3

spl_Set "visibilitySettings" "CustomVisibilitySphereYaw" 0.0

spl_Set "visibilitySettings" "CustomVisibilitySpherePitch" 0.0

spl_Set "visibilitySettings" "CustomVisibilitySphereCoverage" 180.0

spl_Set "visibilitySettings" "Enabled" false

 

-- bone settings

spl_Create "BoneSettings" "boneSettings"

spl_Set "boneSettings" "BoneCount" 2147483647

spl_Set "boneSettings" "BoneRatio" 1.0

spl_Set "boneSettings" "BoneReductionTargets" "SG_BONEREDUCTIONTARGET_ALL"

spl_Set "boneSettings" "LimitBonesPerVertex" false

spl_Set "boneSettings" "LockBoneSelectionSetName" ""

spl_Set "boneSettings" "MaxBonePerVertex" 16

spl_Set "boneSettings" "MaxDeviation" 0.0

spl_Set "boneSettings" "OnScreenSize" 2147483647

spl_Set "boneSettings" "RemoveUnusedBones" false

spl_Set "boneSettings" "RemoveBoneSelectionSetName" ""

spl_Set "boneSettings" "Enabled" false

 

-- reduction processor

spl_Create "ReductionProcessor" "reductionProcessor"

spl_Set "reductionProcessor" "ReductionSettings" "reductionSettings"

spl_Set "reductionProcessor" "NormalCalculationSettings" "normalCalculationSettings"

spl_Set "reductionProcessor" "RepairSettings" "repairSettings"

spl_Set "reductionProcessor" "VisibilitySettings" "visibilitySettings"

spl_Set "reductionProcessor" "BoneSettings" "boneSettings"

 

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

spl_Create "ProcessNode" "processNode"

spl_SetString "processNode" "Name" "processNode"

spl_Set "processNode" "DefaultTBNType" "SG_TANGENTSPACEMETHOD_ORTHONORMAL"

spl_Set "processNode" "Processor" "reductionProcessor"

 

-- write node (add to process node)

spl_Create "WriteNode" "writeNode"

spl_SetString "writeNode" "Format" "ssf"

spl_SetString "writeNode" "Name" "outputlod_0"

spl_Add "processNode" "Children" "writeNode"

 

-- container node (add process node to container node)

spl_Create "ContainerNode" "containerNode"

spl_SetString "containerNode" "Name" "containerNode"

spl_Add "containerNode" "Children" "processNode"

 

-- assign container node to node

spl_Set "sampleReductionSPL" "ProcessGraph" "containerNode"

 

sgsdk_UseSPL "sampleReductionSPL"

sgsdk_SetBatchMode true

sgsdk_ProcessSelectedGeometries()

 

Remeshing

sampleRemeshingSPL = spl_Create "SPL" "sampleRemeshingSPL"

 

-- remeshing settings

spl_Create "RemeshingSettings" "remeshingSettings"

spl_Set "remeshingSettings" "CuttingPlaneSelectionSetName" ""

spl_Set "remeshingSettings" "HardEdgeAngleInRadians" 1.3955555555555557

spl_Set "remeshingSettings" "EmptySpaceOverride" 0.0

spl_Set "remeshingSettings" "MaxTriangleSize" 0

spl_Set "remeshingSettings" "MergeDistance" 4

spl_Set "remeshingSettings" "OnScreenSize" 300

spl_Set "remeshingSettings" "ProcessSelectionSetName" ""

spl_Set "remeshingSettings" "SurfaceTransferMode" "SG_SURFACETRANSFER_ACCURATE"

spl_Set "remeshingSettings" "TransferColors" false

spl_Set "remeshingSettings" "TransferNormals" false

spl_Set "remeshingSettings" "UseCuttingPlanes" false

spl_Set "remeshingSettings" "UseEmptySpaceOverride" false

spl_Set "remeshingSettings" "Enabled" true

 

-- mapping image settings

spl_Create "MappingImageSettings" "mappingImageSettings"

spl_Set "mappingImageSettings" "AllowTransparencyMapping" false

spl_Set "mappingImageSettings" "AutomaticTextureSizeMultiplier" 1.0

spl_Set "mappingImageSettings" "ChartAggregatorMode" "SG_CHARTAGGREGATORMODE_SURFACEAREA"

spl_Set "mappingImageSettings" "ChartAggregatorOriginalChartProportionsChannel" "Diffuse"

spl_Set "mappingImageSettings" "ChartAggregatorOriginalTexCoordLevel" 0

spl_Set "mappingImageSettings" "ChartAggregatorOriginalTexCoordLevelName" ""

spl_Set "mappingImageSettings" "ChartAggregatorSeparateOverlappingCharts" true

spl_Set "mappingImageSettings" "ForcePower2Texture" true

spl_Set "mappingImageSettings" "GenerateMappingImage" true

spl_Set "mappingImageSettings" "GenerateTangents" true

spl_Set "mappingImageSettings" "GenerateTexCoords" true

spl_Set "mappingImageSettings" "GutterSpace" 4

spl_Set "mappingImageSettings" "Height" 512

spl_Set "mappingImageSettings" "MaximumLayers" 3

spl_Set "mappingImageSettings" "MultisamplingLevel" 3

spl_Set "mappingImageSettings" "ParameterizerMaxStretch" 0.11999999731779099

spl_Set "mappingImageSettings" "TexCoordGeneratorType" "SG_TEXCOORDGENERATORTYPE_PARAMETERIZER"

spl_Set "mappingImageSettings" "TexCoordLevel" 255

spl_Set "mappingImageSettings" "UseAutomaticTextureSize" false

spl_Set "mappingImageSettings" "UseFullRetexturing" false

spl_Set "mappingImageSettings" "UseVertexWeights" false

spl_Set "mappingImageSettings" "Width" 512

spl_Set "mappingImageSettings" "Enabled" true

 

-- visibility settings

spl_Create "VisibilitySettings" "visibilitySettings"

spl_Set "visibilitySettings" "CameraSelectionSetName" ""

spl_Set "visibilitySettings" "ConservativeMode" false

spl_Set "visibilitySettings" "CullOccludedGeometry" false

spl_Set "visibilitySettings" "FillNonVisibleAreaThreshold" 0.0

spl_Set "visibilitySettings" "ForceVisibilityCalculation" false

spl_Set "visibilitySettings" "OccluderSelectionSetName" ""

spl_Set "visibilitySettings" "RemoveTrianglesNotOccludingOtherTriangles" true

spl_Set "visibilitySettings" "UseBackfaceCulling" true

spl_Set "visibilitySettings" "UseVisibilityWeightsInReducer" false

spl_Set "visibilitySettings" "UseVisibilityWeightsInTexcoordGenerator" false

spl_Set "visibilitySettings" "VisibilityWeightsPower" 1.0

spl_Set "visibilitySettings" "UseCustomVisibilitySphere" false

spl_Set "visibilitySettings" "CustomVisibilitySphereFidelity" 3

spl_Set "visibilitySettings" "CustomVisibilitySphereYaw" 0.0

spl_Set "visibilitySettings" "CustomVisibilitySpherePitch" 0.0

spl_Set "visibilitySettings" "CustomVisibilitySphereCoverage" 180.0

spl_Set "visibilitySettings" "Enabled" false

 

-- bone settings

spl_Create "BoneSettings" "boneSettings"

spl_Set "boneSettings" "BoneCount" 2147483647

spl_Set "boneSettings" "BoneRatio" 1.0

spl_Set "boneSettings" "BoneReductionTargets" "SG_BONEREDUCTIONTARGET_ALL"

spl_Set "boneSettings" "LimitBonesPerVertex" false

spl_Set "boneSettings" "LockBoneSelectionSetName" ""

spl_Set "boneSettings" "MaxBonePerVertex" 16

spl_Set "boneSettings" "MaxDeviation" 0.0

spl_Set "boneSettings" "OnScreenSize" 2147483647

spl_Set "boneSettings" "RemoveUnusedBones" false

spl_Set "boneSettings" "RemoveBoneSelectionSetName" ""

spl_Set "boneSettings" "Enabled" false

 

-- remeshing processor

spl_Create "RemeshingProcessor" "remeshingProcessor"

spl_Set "remeshingProcessor" "RemeshingSettings" "remeshingSettings"

spl_Set "remeshingProcessor" "MappingImageSettings" "mappingImageSettings"

spl_Set "remeshingProcessor" "VisibilitySettings" "visibilitySettings"

spl_Set "remeshingProcessor" "BoneSettings" "boneSettings"

 

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

spl_Create "ProcessNode" "processNode"

spl_SetString "processNode" "Name" "processNode"

spl_Set "processNode" "DefaultTBNType" "SG_TANGENTSPACEMETHOD_ORTHONORMAL"

spl_Set "processNode" "Processor" "remeshingProcessor"

 

-- ambient color caster

spl_Create "ColorCaster" "ambientColorCaster"

spl_Set "ambientColorCaster" "BakeOpacityInAlpha" false

spl_SetString "ambientColorCaster" "ColorType" "Ambient"

spl_Set "ambientColorCaster" "Dilation" 0

spl_Set "ambientColorCaster" "DitherType" "SG_DITHERPATTERNS_NO_DITHER"

spl_Set "ambientColorCaster" "FillMode" "SG_ATLASFILLMODE_INTERPOLATE"

spl_Set "ambientColorCaster" "OutputChannelBitDepth" 8

spl_Set "ambientColorCaster" "OutputChannels" 4

spl_Set "ambientColorCaster" "OutputSRGB" true

spl_Set "ambientColorCaster" "UseMultisampling" true

spl_SetString "ambientColorCaster" "Name" "Ambient"

spl_SetString "ambientColorCaster" "Channel" "Ambient"

spl_Set "ambientColorCaster" "Enabled" true

 

-- diffuse color caster

spl_Create "ColorCaster" "diffuseColorCaster"

spl_Set "diffuseColorCaster" "BakeOpacityInAlpha" false

spl_SetString "diffuseColorCaster" "ColorType" "Diffuse"

spl_Set "diffuseColorCaster" "Dilation" 0

spl_Set "diffuseColorCaster" "DitherType" "SG_DITHERPATTERNS_NO_DITHER"

spl_Set "diffuseColorCaster" "FillMode" "SG_ATLASFILLMODE_INTERPOLATE"

spl_Set "diffuseColorCaster" "OutputChannelBitDepth" 8

spl_Set "diffuseColorCaster" "OutputChannels" 4

spl_Set "diffuseColorCaster" "OutputSRGB" true

spl_Set "diffuseColorCaster" "UseMultisampling" true

spl_SetString "diffuseColorCaster" "Name" "Diffuse"

spl_SetString "diffuseColorCaster" "Channel" "Diffuse"

spl_Set "diffuseColorCaster" "Enabled" true

 

-- specular color caster

spl_Create "ColorCaster" "specularColorCaster"

spl_Set "specularColorCaster" "BakeOpacityInAlpha" false

spl_SetString "specularColorCaster" "ColorType" "Specular"

spl_Set "specularColorCaster" "Dilation" 0

spl_Set "specularColorCaster" "DitherType" "SG_DITHERPATTERNS_NO_DITHER"

spl_Set "specularColorCaster" "FillMode" "SG_ATLASFILLMODE_INTERPOLATE"

spl_Set "specularColorCaster" "OutputChannelBitDepth" 8

spl_Set "specularColorCaster" "OutputChannels" 4

spl_Set "specularColorCaster" "OutputSRGB" true

spl_Set "specularColorCaster" "UseMultisampling" true

spl_SetString "specularColorCaster" "Name" "Specular"

spl_SetString "specularColorCaster" "Channel" "Specular"

spl_Set "specularColorCaster" "Enabled" true

 

-- normal caster

spl_Create "NormalCaster" "normalCaster"

spl_Set "normalCaster" "Dilation" 0

spl_Set "normalCaster" "DitherType" "SG_DITHERPATTERNS_NO_DITHER"

spl_Set "normalCaster" "FillMode" "SG_ATLASFILLMODE_INTERPOLATE"

spl_Set "normalCaster" "FlipBackfacingNormals" false

spl_Set "normalCaster" "FlipGreen" false

spl_Set "normalCaster" "GenerateTangentSpaceNormals" true

spl_Set "normalCaster" "NormalsChannel" "SG_MATERIAL_CHANNEL_NORMALS"

spl_Set "normalCaster" "OutputChannelBitDepth" 8

spl_Set "normalCaster" "OutputChannels" 3

spl_SetString "normalCaster" "Name" "Normals"

spl_SetString "normalCaster" "Channel" "Normals"

spl_Set "normalCaster" "Enabled" true

 

-- append casters to process node

spl_Add "processNode" "MaterialCaster" "ambientColorCaster"

spl_Add "processNode" "MaterialCaster" "diffuseColorCaster"

spl_Add "processNode" "MaterialCaster" "specularColorCaster"

spl_Add "processNode" "MaterialCaster" "normalCaster"

 

-- write node (add to process node)

spl_Create "WriteNode" "writeNode"

spl_SetString "writeNode" "Format" "ssf"

spl_SetString "writeNode" "Name" "outputlod_0"

spl_Add "processNode" "Children" "writeNode"

 

-- container node (add process node to container node)

spl_Create "ContainerNode" "containerNode"

spl_SetString "containerNode" "Name" "containerNode"

spl_Add "containerNode" "Children" "processNode"

 

-- assign container node to node

spl_Set sampleRemeshingSPL "ProcessGraph" "containerNode"

 

sgsdk_UseSPL sampleRemeshingSPL

sgsdk_SetBatchMode true

sgsdk_ProcessSelectedGeometries()