Simple Quad Reduction pipeline
This example shows how to create a new QuadReductionPipeline
and how to set basic parameters for reduction and material baking.
MaxScript
-- create a QuadReductionPipeline object
quadReductionPipeline = sgsdk_CreatePipeline "QuadReductionPipeline"
-- set DefaultTangentCalculatorType to Autodesk3dsMax (1)
bResult = sgsdk_SetSetting quadReductionPipeline "GlobalSettings/DefaultTangentCalculatorType" 1
defaultTangentCalculatorType = sgsdk_GetSetting quadReductionPipeline "GlobalSettings/DefaultTangentCalculatorType"
print ("DefaultTangentCalculatorType: " + defaultTangentCalculatorType as string + "\n")
-- set the triangle ratio to 50%
bResult = sgsdk_SetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio" 0.5
reductionTargetPolygonRatio = sgsdk_GetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio"
print ("ReductionTargetPolygonRatio: " + reductionTargetPolygonRatio as string + "\n")
-- set the reduction target to triangle ratio
bResult = sgsdk_SetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled" true
reductionTargetPolygonRatioEnabled = sgsdk_GetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled"
print ("ReductionTargetPolygonRatioEnabled: " + reductionTargetPolygonRatioEnabled as string + "\n")
-- disable triangle count reduction target
bResult = sgsdk_SetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled" false
reductionTargetPolygonCountEnabled = sgsdk_GetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled"
print ("ReductionTargetPolygonCountEnabled: " + reductionTargetPolygonCountEnabled as string + "\n")
-- disable max deviation reduction target
bResult = sgsdk_SetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled" false
reductionTargetMaxDeviationEnabled = sgsdk_GetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled"
print ("ReductionTargetMaxDeviationEnabled: " + reductionTargetMaxDeviationEnabled as string + "\n")
-- disable onscreensize reduction target
bResult = sgsdk_SetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled" false
reductionTargetOnScreenSizeEnabled = sgsdk_GetSetting quadReductionPipeline "QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled"
print ("ReductionTargetOnScreenSizeEnabled: " + reductionTargetOnScreenSizeEnabled as string + "\n")
-- more settings can be set for the Reduction pipeline,
-- see Pipeline documentation and/or inspect the generated file
-- that is saved out by this script!
-- save the generated Pipeline object to file for later use
bResult = sgsdk_SavePipeline quadReductionPipeline "D:/Pipelines/QuadReduction.json"
-- clear all pipelines
sgsdk_ClearPipelines()
python
from pymxs import runtime as rt
# create a QuadReductionPipeline object
quadReductionPipeline = rt.sgsdk_CreatePipeline('QuadReductionPipeline')
# set DefaultTangentCalculatorType to Autodesk3dsMax (1)
bResult = rt.sgsdk_SetSetting(quadReductionPipeline, 'GlobalSettings/DefaultTangentCalculatorType', 1)
defaultTangentCalculatorType = rt.sgsdk_GetSetting(quadReductionPipeline, 'GlobalSettings/DefaultTangentCalculatorType')
print ('DefaultTangentCalculatorType: ' + str(defaultTangentCalculatorType) + '\n')
# set the triangle ratio to 50%
bResult = rt.sgsdk_SetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio', 0.5)
reductionTargetPolygonRatio = rt.sgsdk_GetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatio')
print ('ReductionTargetPolygonRatio: ' + str(reductionTargetPolygonRatio) + '\n')
# set the reduction target to ReductionTargetPolygonRatio
bResult = rt.sgsdk_SetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled', True)
reductionTargetPolygonRatioEnabled = rt.sgsdk_GetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonRatioEnabled')
print ('ReductionTargetPolygonRatioEnabled: ' + str(reductionTargetPolygonRatioEnabled) + '\n')
# disable triangle count reduction target
bResult = rt.sgsdk_SetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled', False)
reductionTargetPolygonCountEnabled = rt.sgsdk_GetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetPolygonCountEnabled')
print ('ReductionTargetPolygonCountEnabled: ' + str(reductionTargetPolygonCountEnabled) + '\n')
# disable max deviation reduction target
bResult = rt.sgsdk_SetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled', False)
reductionTargetMaxDeviationEnabled = rt.sgsdk_GetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetMaxDeviationEnabled')
print ('ReductionTargetMaxDeviationEnabled: ' + str(reductionTargetMaxDeviationEnabled) + '\n')
# disable onscreensize reduction target
bResult = rt.sgsdk_SetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled', False)
reductionTargetOnScreenSizeEnabled = rt.sgsdk_GetSetting(quadReductionPipeline, 'QuadReductionProcessor/QuadReductionSettings/ReductionTargetOnScreenSizeEnabled')
print ('ReductionTargetOnScreenSizeEnabled: ' + str(reductionTargetOnScreenSizeEnabled) + '\n')
# more settings can be set for the Reduction pipeline,
# see Pipeline documentation and/or inspect the generated file
# that is saved out by this script!
# save the generated Pipeline object to file for later use
bResult = rt.sgsdk_SavePipeline(quadReductionPipeline, 'D:/Pipelines/QuadReduction.json')
# clear all pipelines
rt.sgsdk_ClearPipelines()
Next steps
Get to know how to use the Reduction Pipeline: