display
display module
This module exposes functions that change how the model of a project is presented in the viewports. They correspond to settings available in the “Display Settings” window.
The Environment Map used to light the scene can be retrieved with
get_environment_resource()
, or set with set_environment_resource()
.
The look up table (LUT) used as a Color Profile can be retrieved with
get_color_lut_resource()
, or set with set_color_lut_resource()
.
Example
import substance_painter.display
# Show the currently used color profile:
color_lut = substance_painter.display.get_color_lut_resource()
if (color_lut != None):
print(color_lut.url())
else:
print("No color profile is used.")
# Set a different color profile:
new_color_lut = substance_painter.resource.ResourceID(context="starter_assets",
name="sepia")
substance_painter.display.set_color_lut_resource(new_color_lut)# Show the currently used environment map:
envmap = substance_painter.display.get_environment_resource()
print(envmap.url())
# Set a different environment map:
new_envmap = substance_painter.resource.ResourceID(context="starter_assets",
name="Bonifacio Street")
substance_painter.display.set_environment_resource(new_envmap)# Show the currently active tone mapping operator:
try:
tone_mapping = substance_painter.display.get_tone_mapping()
print(tone_mapping)
except RuntimeError:
print("The project is color managed; tone mapping is not available")
# Set a different tone mapping:
try:
new_tone_mapping = substance_painter.display.ToneMappingFunction.ACES
substance_painter.display.set_tone_mapping(new_tone_mapping)
except RuntimeError:
print("The project is color managed; tone mapping is not available")
See also
substance_painter.resource
,
Color Profile documentation,
Environment Settings documentation,
Camera Settings documentation.
-
class substance_painter.display.
ToneMappingFunction
ToneMappingFunction(value) Tone mapping function used in display.
This corresponds to the “Tone mapping” list in the “Camera settings” section of the “Display settings” view.
Members:
Name Description Linear
Transformation from linear to sRGB without any color remapping. Color values above 1 are clamped. ACES
Use the standard color remapping from the Academy Color Encoding System (ACES).
-
substance_painter.display.
get_environment_resource
get_environment_resource() → Optional[ResourceID] Get the environment map resource of the active project.
- Returns
The environment map resource or None.
- Return type
- Raises
- ProjectError – If no project is opened.
- ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
-
substance_painter.display.
set_environment_resource
set_environment_resource(new_env_map: ResourceID) → None Set the environment map resource of the active project.
- Parameters
new_env_map (ResourceID) – The new environment map resource.
- Raises
- ProjectError – If no project is opened.
- TypeError – If
new_env_map
is not a ResourceID. - ResourceNotFoundError – If the environment map
new_env_map
is not found. - ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
-
substance_painter.display.
get_color_lut_resource
get_color_lut_resource() → Optional[ResourceID] Get the color profile LUT resource of the active project.
- Returns
The color profile LUT resource or None.
- Return type
- Raises
- ProjectError – If no project is opened.
- ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
-
substance_painter.display.
set_color_lut_resource
set_color_lut_resource(new_color_lut: ResourceID) → None Set the color profile LUT resource of the active project.
- Parameters
new_color_lut (ResourceID) – The new color profile LUT.
- Raises
- ProjectError – If no project is opened.
- TypeError – If
new_color_lut
is not a ResourceID. - ResourceNotFoundError – If the color profile
new_color_lut
is not found. - ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
-
substance_painter.display.
get_tone_mapping
get_tone_mapping() → ToneMappingFunction Get the tone mapping operator used to display the current project.
Note
The tone mapping function is disabled when color management is enabled. In that case trying to call get_tone_mapping will throw a RuntimeError.
- Returns
- The tone mapping function currently used by
the project.
- Return type
- Raises
- RuntimeError – If the project is color managed.
- ProjectError – If no project is opened.
- ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
-
substance_painter.display.
set_tone_mapping
set_tone_mapping(new_tone_mapping: ToneMappingFunction) → None Set the tone mapping operator to display the current project.
Note
The tone mapping function is disabled when color management is enabled. In that case trying to call set_tone_mapping will throw a RuntimeError.
- Parameters
new_tone_mapping (ToneMappingFunction) – The new tone mapping function to use in the project.
- Raises
- TypeError – If
new_tone_mapping
is not a ToneMappingFunction. - RuntimeError – If the project is color managed.
- ProjectError – If no project is opened.
- ServiceNotFoundError – If Substance 3D Painter has not started all its services yet.
- TypeError – If