色阶效果
LevelsEffectNode是一种用于调整图像颜色范围的效果。 它允许平衡和色调颜色和/或灰度值。
TIP
另请参阅: 色阶效果文档。
示例
import substance_painter as sp
# Get the currently displayed Stack
stack = sp.textureset.get_active_stack()
# Get top position of the Stack
position_stack_top = sp.layerstack.InsertPosition.from_textureset_stack(stack)
# Insert Fill Layer
my_fill_layer = sp.layerstack.insert_fill(position_stack_top)
my_fill_layer.set_name("My Fill Layer")
# Load noise into Metallic channel
noise_resource = sp.resource.search("s:starterassets "
"u:procedural "
"n:3D Perlin Noise")[0]
my_fill_layer.set_source(sp.layerstack.ChannelType.Metallic, noise_resource.identifier())
# Add a Levels effect in the content stack
inside_content = sp.layerstack.InsertPosition.inside_node(
my_fill_layer, sp.layerstack.NodeStack.Content)
my_levels_effect = sp.layerstack.insert_levels_effect(inside_content)
# Update the affected channel to Metallic
my_levels_effect.affected_channel = sp.layerstack.ChannelType.Metallic
# Update the Levels effect parameters
parameters = my_levels_effect.get_parameters()
# Note: `parameters` is a LevelsParamsMono because Metallic channel has only a luminance channel
parameters.input_min = 0.25
parameters.input_max = 0.75
my_levels_effect.set_parameters(parameters)
# Select the Levels effect
sp.layerstack.set_selected_nodes([my_levels_effect])
函数和类
substance_painter.layerstack.insert_levels_effect(position: InsertPosition) -> LevelsEffectNode substance_painter.layerstack.insert_levels_effect
使用默认参数插入色阶效果。
参数:
位置 (InsertPosition) — 插入位置必须位于带有NodeStack.Content的LayerNode内或NodeStack.Mask或高于/低于EffectNode。
引发:
ValueError — 如果由于位置无效而导致插入失败。 请参阅InsertPosition。
返回:插入的节点。
返回类型: LevelsEffectNode
类substance_painter.layerstack.LevelsEffectNode(uid) substance_painter.layerstack.LevelsEffectNode
基数: Node
允许操作“色阶”效果的节点。
TIP
另请参阅: 色阶效果文档
property affected_channel: ChannelType substance_painter.layerstack.LevelsEffectNode.affected_channel
受当前电平效果影响的通道。
Getter:返回受影响的通道。
Setter:设置受影响的通道。
类型: ChannelType
get_parameters() -> LevelsParamsMono | LevelsParamsRGB substance_painter.layerstack.LevelsEffectNode.get_parameters
获取此级别效果的当前参数。
返回:当前级别参数。
返回类型: LevelsParamsMono | LevelsParamsRGB
set_parameters(params: LevelsParamsMono | LevelsParamsRGB) ->无 substance_painter.layerstack.LevelsEffectNode.set_parameters
为此级别效果设置新参数。
参数: 参数 (LevelsParamsMono | LevelsParamsRGB) — 新参数。
返回类型:无
参数
类substance_painter.levels.LevelsParamsRGB(input_min: Tuple[float, float, float] = (0.0, 0.0, 0.0), input_max: Tuple[float, float, float] = (1.0, 1.0, 1.0), gamma: Tuple[float, float, float] = (1.0, 1.0), output_min: Tuple[float, float, float] = (0.0, 0.0, 0.0) tuple[float, float, float] = (1.0, 1.0, 1.0),固定: bool = False) substance_painter.levels.LevelsParamsRGB
色阶参数,在RGB色彩模式下使用。
参数:
- input_min (Tuple [ float**, float*,* float*]*) — 最小输入阈值。
- input_max (Tuple [ float**, float*,* float*]*) — 最大输入阈值。
- 灰度系数 (元组 [ 浮动**, 浮动*,* 浮动*]*) — 灰度系数。
- 输出_min (元组 [ 浮点**, 浮点*,* 浮点*]*) — 最小输出阈值。
- 输出_max (元组 [ 浮点**, 浮点*,* 浮点*]*) — 最大输出阈值。
- 固定 (bool) — 是否应固定这些值。
class substance_painter.levels.LevelsParamsMono(input_min: float = 0.0, input_max: float = 1.0, gamma: float = 1.0, output_min: float = 0.0, output_max: float = 1.0, clamp: bool = False) substance_painter.levels.LevelsParamsMono
色阶参数,当处于明亮度模式或仅有一种颜色模式时。
参数:
- input_min (float) — 最小输入阈值。
- input_max (float) — 最大输入阈值。
- 灰度系数 (浮动) — 灰度系数。
- 输出_min (浮点) — 最小输出阈值。
- 输出_max (浮点) — 最大输出阈值。
- 固定 (bool) — 是否应固定这些值。
substance_painter.levels.LevelsParams substance_painter.levels.LevelsParams
LevelsParamsMono的别名 | LevelsParamsRGB
色阶参数可以表示为三个通道(RGB)或仅一个颜色通道(仅一个颜色或明亮度)。 使用LevelsParams将两个可能的参数风味重新分组。
recommendation-more-help
substance-3d-dev-help-painter-python-guide