Skip to content
On this page

Vertex colors as vertex weights

Vertex weights can be used to tell the reduction which parts of the mesh that are important and which are not. Weights can also be used when baking materials, or rather to change the size of the UVs which will affect how much texture space gets used for given parts of the mesh. An example where weights can be applied is when you would want to preserve details on a character, such as nose and eyes.

Creates a ReductionPipeline that will use the specified color-set as vertex weights.

MaxScript
-- creates a reduction pipeline
    reductionPipeline = sgsdk_CreatePipeline "ReductionPipeline"
    ...

    -- enables vertex weights in reducer
    bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/UseVertexWeightsInReducer" true

    -- enables vertex weights in material caster
    bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/UseVertexWeightsInTexcoordGenerator" true

    -- sets which vertex-color-set to be used as weights
    bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorName" "3"
python
from pymxs import runtime as rt

# creates a reduction pipeline
reductionPipeline = rt.sgsdk_CreatePipeline('ReductionPipeline')
...

# enables vertex weights in material caster
bResult = rt.sgsdk_SetSetting(reductionPipeline, 'ReductionProcessor/VertexWeightSettings/UseVertexWeightsInTexcoordGenerator', True)

# sets which vertex-color-set to be used as weights
bResult = rt.sgsdk_SetSetting(reductionPipeline, 'ReductionProcessor/VertexWeightSettings/WeightsFromColorName', '3')

Sets the strength (multiplier) of the weights.

MaxScript
-- sets the strength of the weights (2 is low, 8 is high, 4 is default)
    bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorMultiplier" 8
python
from pymxs import runtime as rt

# sets the strength of the weights (2 is low, 8 is high, 4 is default)
bResult = rt.sgsdk_SetSetting(reductionPipeline, 'ReductionProcessor/VertexWeightSettings/WeightsFromColorMultiplier', 8)

Sets the color component to use as weights.

MaxScript
-- sets the color component to use as weights (R = 0, G = 1, B = 2, A = 3, default = 0)
    bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorComponent" 0
python
from pymxs import runtime as rt

# sets the color component to use as weights (R = 0, G = 1, B = 2, A = 3, default = 0)
bResult = rt.sgsdk_SetSetting(reductionPipeline, 'ReductionProcessor/VertexWeightSettings/WeightsFromColorComponent', 0)

The weights color mode (previously interpreter) can be used to change the interpretation of weights.

0 Black: reduce more | White: reduce less
1 Black: unchanged | White: reduce less
2 Black: reduce more | White: unchanged

Sets the weights color mode.

MaxScript
-- sets the color mode for weights (default = 0)
    bResult = sgsdk_SetSetting reductionPipeline "ReductionProcessor/VertexWeightSettings/WeightsFromColorMode" 0
python
from pymxs import runtime as rt

# sets the color mode for weights (default = 0)
bResult = rt.sgsdk_SetSetting(reductionPipeline, ss = 'ReductionProcessor/VertexWeightSettings/WeightsFromColorMode', 0)