Migrate from Simplygon 8 to Simplygon 10
The Simplygon Max plug-in exports various commands and flags that exposes Simplygon functionality through Max. Since Simplygon 8 there's been breaking changes to core features as well as the Simplygon API in general. The standalone Simplygon UI and the fundamentals it was built upon, as well as Simplygon Processing Language (SPL) and the Simplygon Scene Format (SSF) no longer exists. The Simplygon Max plug-in work directly against the Simplygon API. Compatibility with previous versions is kept where possible, but there are some fundamental things that has changed and improved.
This guide will focus on how to migrate from Simplygon 8 to Simplygon 10.
Installation
Simplygon 8 install scripts will no longer work with Simplygon 10. Instead, Simplygon 10 relies on environment variables to find certain components compared to previous solution of registry and configuration files. We recommend the Simplygon installer as it not only sets everything up correctly, but also installs all necessary prerequisites. We also provide a Simplygon 10 archive for manual installation. See the Simplygon 10 plug-in installation for further instructions. Please note that Simplygon 10 relies on its own set of environment flags.
Simplygon UI
The standalone Simplygon UI has been replaced by a lightweight UI in the form of a Max plug-in. The UI plug-in is bundled with the installer and will show up in the plug-in manager after installation. See the Simplygon 10 plug-in installation for further instructions on how to enable plug-ins in Max.
Settings system
The settings system has been completely revamped which means that old settings of the SPL- and Preset format is no longer compatible with Simplygon 10. The successor of SPL is Pipeline objects. Pipelines are made to make the life easier for users by encapsulating functionality in Pipeline objects. Some of our common Pipelines are; Reduction, Aggregation, Remeshing as well as several Impostor pipelines. These pipelines have a 1-to-1 mapping to the Simplygon API and should feel quite familiar to existing users. Pipelines are saved as text-based files with JSON extension. The job distribution system (that was previously part of Simplygon Grid) is now part of Pipelines.
Note that some settings have been added, removed, renamed and / or moved to a different settings group, see the SPL-to-Pipeline documentation for information of how to migrate SPL to Pipelines.
New Remesher
The new Remesher that was introduced in Simplygon 9 completely replaces the old remesher in Simplygon 10. The old remesher (deprecated in Simplygon 9) has been completely removed in Simplygon 10. The new remesher introduces features such as intelligent hole-filling, cavity removal as well as some performance increases when generating large OnScreenSize meshes.
New remesher:
- RemeshingPipeline
- RemeshingProcessor
- RemeshingSettings
For more information, see the Remeshing Pipeline example and Remeshing Pipeline API documentation.
Script migration
The following sections contain details of how to migrate specific parts from Simplygon 8 to Simplygon 10.
General Simplygon functions
Previously | Status | Replacement | Note |
---|---|---|---|
sgsdk_SetLoginInfo | Removed | User system has been removed | |
sgsdk_SetBatchMode | Removed | Standalone UI has been removed | |
sgsdk_GetBatchMode | Removed | Standalone UI has been removed | |
sgsdk_ProcessSelectedGeometries | Replaced (deprecated) | sgsdk_RunPipelineOnSelection | Now takes a Pipeline-object or Pipeline-path as input |
sgsdk_SetSettingsPath | Replaced | sgsdk_SetPipeline | Now takes a Pipeline-object or Pipeline-path as input |
sgsdk_UseSPL | Replaced | sgsdk_SetPipeline | Now takes a Pipeline-object or Pipeline-path as input |
sgsdk_MaterialTexture | Updated | Now takes sRGB flag as last argument | |
sgsdk_CustomShaderChannelOverride | Removed | ||
sgsdk_SetUseColorChannelAsWeights | Removed | Moved to Pipeline settings | |
sgsdk_SetWeightsMultiplier | Removed | Moved to Pipeline settings | |
sgsdk_SetWeightsInterpreter | Removed | Moved to Pipeline settings | |
sgsdk_SetLockOnBone | Removed | Moved to Pipeline settings (selection-set) |
See Simplygon functions for more details.
SPL- to Pipeline functions
Previously | Status | Replacement | Note |
---|---|---|---|
spl_Save | Replaced | sgsdk_SavePipeline | Saves Pipeline-object to file. |
spl_Load | Replaced | sgsdk_LoadPipeline | Loads Pipeline-object from file. |
spl_Create | Replaced | sgsdk_CreatePipeline | Use to create Pipeline-object. |
spl_Set | Replaced | sgsdk_SetSetting | Specify setting path and value to set |
spl_SetString | Replaced | sgsdk_SetSetting | Specify setting path and value to set |
spl_Get | Replaced | sgsdk_GetSetting | Specify setting path from where to fetch the setting value |
spl_Add | Removed | ||
spl_Remove | Removed | ||
spl_GetChild | Removed | ||
spl_ClearList | Removed | ||
spl_GetParameter | Removed | ||
spl_Clear | Replaced | sgsdk_ClearPipelines | Clears all Pipelines that resides in memory (created and loaded) |
See Simplygon Pipeline functions for more details.
Shading network functions
Previously | Status | Replacement | Note |
---|---|---|---|
sgsdk_ConnectOutputToMaterialMetadata | Replaced | sgsdk_ConnectOutputToDirectXMaterial | Now takes target shader (effect) file path, source material channel (the one with baked texture) and target texture slot |
See Simplygon Shading Network functions for more details.
Load and save settings
Loading a SPL-file was previously done using the spl_Load function followed by the file path and the name of the handle the SPL object. The spl_Save function takes the file path and the SPL object handle.
reductionObject = spl_Load "D:/Pipelines/Reduction.spl" "reductionObjectName"
spl_Save "D:/Pipelines/Reduction.spl" reductionObject
For Pipelines the loading of files translates to the sgsdk_LoadPipeline function followed by the file path. The function returns the Pipeline handle as soon as the load has completed. Saving works in a similar fashion; sgsdk_SavePipeline followed by the file path and the Pipeline handle.
reductionPipeline = sgsdk_LoadPipeline "D:/Pipelines/Reduction.json"
bResult = sgsdk_SavePipeline "D:/Pipelines/Reduction.json" reductionPipeline
Get and set settings
The SPL settings system in Simplygon 8 has been replaced by the Pipeline settings system which are focusing more on ease-of-use. To set a setting in a Pipeline, simply specify the setting path and value, or just setting path for queries. There is no longer any need to manually traverse the SPL graph to be able to set and get settings, no more containers or write nodes are necessary.
Note that some settings have been added, removed, renamed and / or moved to a different settings group, see the SPL-to-Pipeline documentation for information of how to migrate SPL to Pipelines.
Previously these lines were required to create a "simple" 50% reduction:
-- create SPL object
reductionObject = spl_Create "SPL" "reductionObject"
-- create reduction settings
spl_Create "ReductionSettings" "reductionSettings"
spl_Set "reductionSettings" "TriangleRatio" 0.5
spl_Set "reductionSettings" "Enabled" true
-- create reduction processor and assign the reduction settings
spl_Create "ReductionProcessor" "reductionProcessor"
spl_Set "reductionProcessor" "ReductionSettings" "reductionSettings"
-- create process node and assign reduction processor
spl_Create "ProcessNode" "processNode"
spl_SetString "processNode" "Name" "processNode"
spl_Set "processNode" "Processor" "reductionProcessor"
-- create write node and add it to the process node
spl_Create "WriteNode" "writeNode"
spl_SetString "writeNode" "Format" "ssf"
spl_SetString "writeNode" "Name" "outputlod_0"
spl_Add "processNode" "Children" "writeNode"
-- create 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 spl node
spl_Set reductionObject "ProcessGraph" "containerNode"
-- execute Simplygon in batch mode with the provided SPL object
sgsdk_UseSPL reductionObject
sgsdk_SetBatchMode true
sgsdk_ProcessSelectedGeometries()
The new Pipeline settings system reduces the lines above to:
-- create a reduction Pipeline object
reductionPipeline = sgsdk_CreatePipeline "ReductionPipeline"
-- set the triangle ratio to 50%
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" 0.5
-- execute Simplygon with the provided Pipeline object
sgsdk_RunPipelineOnSelection reductionPipeline
-- clear all pipelines that resides in memory
sgsdk_ClearPipelines()
As you can see there is no direct translation for the get and set flags as Pipeline settings can be set through a settings path and does not require the individual objects.
Here's how to get and set the triangle ratio for a reduction processor:
-- set the triangle ratio to 50%
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio" 0.5
-- get the triangle ratio
reductionTargetTriangleRatio = sgsdk_GetSetting reductionPipeline "ReductionProcessor/ReductionSettings/ReductionTargetTriangleRatio"
-- print the triangle ratio
print ("ReductionTargetTriangleRatio: " + reductionTargetTriangleRatio as string + "\n")
How to setup material baking settings for a reduction Pipeline:
-- mapping image is required for material baking
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/MappingImageSettings/GenerateMappingImage" true
-- generate new texture coordinates
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/MappingImageSettings/GenerateTexCoords" true
-- specify name for generated texture coordinates
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/MappingImageSettings/TexCoordName" "MaterialLOD"
-- width and height of the baked textures
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/MappingImageSettings/Output0/TextureWidth" 512
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/MappingImageSettings/Output0/TextureHeight" 512
-- add a color caster for Max's standard material (Diffuse_Color)
bCasterAdded = sgsdk_AddMaterialCaster reductionPipeline "ColorCaster"
bResult = sgsdk_SetSetting reductionPipeline "MaterialCaster/1/ColorCasterSettings/MaterialChannel" "Diffuse_Color"
-- add normal caster for Max's standard material (Bump)
bCasterAdded = sgsdk_AddMaterialCaster reductionPipeline "NormalCaster"
bResult = sgsdk_SetSetting reductionPipeline "MaterialCaster/2/NormalCasterSettings/MaterialChannel" "Bump"
-- set the correct tangent space type
bResult = sgsdk_SetSetting reductionPipeline "MaterialCaster/2/NormalCasterSettings/GenerateTangentSpaceNormals" true
Material channel mapping
Previously Max's standard materials (Blinn, Phong etc) were mapped to Simplygon materials by redirecting material channels to a pre-defined structure (that was required by the standalone Simplygon UI). As the standalone UI is no longer a part of Simplygon, Max's material channels are used through and through. This removes extra layers of complexity, making life easier for users.
If you wish to bake standard materials in Max, see the updated channel names in the table below.
Previous channel | New channel |
---|---|
Ambient | Ambient_Color |
Diffuse | Diffuse_Color |
Specular | Specular_Color |
Opacity | Opacity |
Normals | Bump |
Selection sets
Selection sets are read automatically from Max's built in selection-sets. Some common features that require a selection-set are Bone Lock, Bone Removal, Processing- and Clipping-sets. To assign a selection-set to a Pipeline, as a processing selection-set or clipping selection-set, see Clipping geometry example, for more information about Pipelines, see Simplygon Pipeline functions.
Vertex colors to vertex weights
The "vertex colors to vertex weights" functionality has been moved from the Simplygon Max plug-in (sgsdk_SetUseColorChannelAsWeights
, sgsdk_SetWeightsMultiplier
, sgsdk_SetWeightsInterpreter
) to Pipelines and is now a part of the Pipeline weights settings. An additional setting has been added to allow users to specify which color component of the vertex colors to use as weights.
Previous method of specifying which mapping channel to use as vertex weights:
-- creates SPL object and populates it with reduction process node, settings and write-node (excluded)
reductionObject = spl_Create SPL reductionObject
...
-- set which vertex-color-set to use as weights, multiplier and interpreter
sgsdk_SetUseColorChannelAsWeights 3
sgsdk_SetWeightsMultiplier 8
sgsdk_SetWeightsInterpreter 0
-- launch Simplygon in batch mode with provided setting object
sgsdk_UseSPL reductionObject
sgsdk_SetBatchMode true
sgsdk_ProcessSelectedGeometries()
New method of specifying which color-set to use as vertex weights:
-- creates a reduction pipeline
reductionPipeline = sgsdk_CreatePipeline "ReductionPipeline"
...
-- enables vertex weights in reducer
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/UseVertexWeightsInReducer" true
-- sets which vertex-color-set to be used as weights
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorName" "3"
-- sets the multiplier
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorMultiplier" 8
-- sets which interpreter to use
bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorMode" 0
...
-- launch Simplygon with provided setting object
sgsdk_RunPipelineOnSelection reductionPipeline
For more information about vertex colors as vertex weights, see Colors as vertex weights.