SBRenderPreset#

This class describes a render preset that contains various rendering settings. You can add multiple render preset nodes in a document, copy them, and apply them to set the global rendering settings accordingly.

The render preset has the following rendering settings which you can specify, including their parameters:

  • Screen-Space Ambient occlusion (SSAO): kernel size, strength, radius, randomization

  • Object-Space Ambient occlusion (OSAO): grid size, strength

  • Anti-aliasing: presets

  • Background: presets and background colors and image

  • Bloom effect: radius, threshold, strength

  • Depth-of-field: strenght, distance

  • Fog: strenght, near and far distances

  • Grid: spacing, thickness, radius, transparency

  • Lighting: parameters for first, second, and global lights

  • Pinhole effect: sharpness

  • Scale: minimum length, thickness

  • Shadows: preset, transparency, spread, offset

  • Silhouettes: color, transparency, thickness, distance threshold, fog attenuation

  • Structural model rendering options: atom and bond radii

Create and add a render preset#
# construct a render preset node
renderPreset = SBRenderPreset("Render preset")
# or create it based on the current rendering settings
#renderPreset = SAMSON.createRenderPreset()

# change the render preset properties

# make the operation undoable
SAMSON.beginHolding("Add render preset")

SAMSON.hold(renderPreset)
# create a render preset node
renderPreset.create()

# add it to the active document
SAMSON.getActiveDocument().addChild(renderPreset)

# stop the undoable operation
SAMSON.endHolding()

You can then simply apply the render preset to change the rendering settings.

Apply a render preset#
# make the operation undoable
SAMSON.beginHolding("Apply render preset")
# apply a render preset
renderPreset.apply()
# stop the undoable operation
SAMSON.endHolding()

See also

SAMSON SDK: SBDDocumentRenderPreset

Rendering

class samson.SBRenderPreset(*args, **kwargs)#

Bases: SBNode

This class describes a render preset.

Overloaded function.

  1. __init__(self: samson.SBRenderPreset) -> None

Constructs a render preset.

  1. __init__(self: samson.SBRenderPreset, name: str) -> None

Constructs a render preset with the given name.

class AntiAliasingPreset(self: samson.SBRenderPreset.AntiAliasingPreset, value: int)#

Bases: pybind11_object

Members:

BestSpeed

BetterSpeed

HigherQuality

HighestQuality

Custom

BestSpeed = <AntiAliasingPreset.BestSpeed: 0>#
BetterSpeed = <AntiAliasingPreset.BetterSpeed: 1>#
Custom = <AntiAliasingPreset.Custom: 4>#
HigherQuality = <AntiAliasingPreset.HigherQuality: 2>#
HighestQuality = <AntiAliasingPreset.HighestQuality: 3>#
property name#
property value#
class BackgroundImageMode(self: samson.SBRenderPreset.BackgroundImageMode, value: int)#

Bases: pybind11_object

Members:

ContainedInViewport

CoveringViewport

ContainedInViewport = <BackgroundImageMode.ContainedInViewport: 0>#
CoveringViewport = <BackgroundImageMode.CoveringViewport: 1>#
property name#
property value#
class BackgroundType(self: samson.SBRenderPreset.BackgroundType, value: int)#

Bases: pybind11_object

Members:

Default

White

Black

Custom

Image

Black = <BackgroundType.Black: 2>#
Custom = <BackgroundType.Custom: 3>#
Default = <BackgroundType.Default: 0>#
Image = <BackgroundType.Image: 4>#
White = <BackgroundType.White: 1>#
property name#
property value#
class LightingPreset(self: samson.SBRenderPreset.LightingPreset, value: int)#

Bases: pybind11_object

Members:

Default

FlatLight

Custom

Custom = <LightingPreset.Custom: 2>#
Default = <LightingPreset.Default: 0>#
FlatLight = <LightingPreset.FlatLight: 1>#
property name#
property value#
class ShadowPreset(self: samson.SBRenderPreset.ShadowPreset, value: int)#

Bases: pybind11_object

Members:

LowQuality

MediumQuality

HighQuality

SoftShadow

Custom

Custom = <ShadowPreset.Custom: 4>#
HighQuality = <ShadowPreset.HighQuality: 2>#
LowQuality = <ShadowPreset.LowQuality: 0>#
MediumQuality = <ShadowPreset.MediumQuality: 1>#
SoftShadow = <ShadowPreset.SoftShadow: 3>#
property name#
property value#
apply(self: samson.SBRenderPreset) None#

Applies the render preset.

This function applies the render preset by setting the rendering preferences in the Main Preferences according to the render preset.

This function is undoable. It calls SAMSON.beginHolding and SAMSON.endHolding internally.

getAntiAliasingPresetString(self: samson.SBRenderPreset.AntiAliasingPreset) str#

Returns a human-readable string representation of the anti-aliasing preset preset.

getBackgroundBottomColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the background bottom color.

getBackgroundImageModeString(self: samson.SBRenderPreset.BackgroundImageMode) str#

Returns a human-readable string representation of the background image mode mode.

getBackgroundTopColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the background top color.

getBackgroundTypeString(self: samson.SBRenderPreset.BackgroundType) str#

Returns a human-readable string representation of the background type type.

getBondRadius(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the bond radius.

getConstantAtomRadius(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the constant atom radius.

getDefaultBondRadius(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default bond radius.

getDefaultConstantAtomRadius(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default constant atom radius.

getDefaultDepthOfFieldDistance(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default distance at which the depth-of-field effect begins.

getDefaultFirstLightColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the first light’s default color.

getDefaultFogFarDistance(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default distance at which fog becomes maximal.

getDefaultFogNearDistance(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default distance at which fog begins.

getDefaultGridRadius(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default grid radius.

getDefaultGridSpacing(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default grid spacing.

getDefaultGridThickness(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default grid thickness.

getDefaultSecondLightColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the second light’s default color.

getDefaultShadowOffset(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the default offset between objects and their shadows.

getDefaultSilhouetteColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the silhouette’s default color.

getDefaultSilhouetteDistanceThreshold(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the silhouette’s default distance threshold.

getDepthOfFieldDistance(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the distance at which the depth-of-field effect begins.

getFirstLightColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the first light’s color.

getFogFarDistance(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the distance at which fog becomes maximal.

getFogNearDistance(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the distance at which fog begins.

getGridRadius(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the grid radius.

getGridSpacing(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the grid spacing.

getGridThickness(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the grid thickness.

getLightingPresetString(self: samson.SBRenderPreset.LightingPreset) str#

Returns a human-readable string representation of the lighting preset preset.

getNextRenderPreset(self: samson.SBRenderPreset) samson.SBRenderPreset#

Returns the next render preset.

getPreviousRenderPreset(self: samson.SBRenderPreset) samson.SBRenderPreset#

Returns the previous render preset.

getSecondLightColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the second light’s color.

getShadowOffset(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the offset between objects and their shadows.

getShadowPresetString(self: samson.SBRenderPreset.ShadowPreset) str#

Returns a human-readable string representation of the shadow preset preset.

getSilhouetteColor(self: samson.SBRenderPreset) samson.SBColor#

Returns the silhouette color.

getSilhouetteDistanceThreshold(self: samson.SBRenderPreset) samson.SBQuantity.unitsSI#

Return the silhouette distance threshold. A pixel is considered to be part of the silhouette if the difference between the depth of one of its neighbors and its own depth is larger than this parameter.

setBackgroundBottomColor(self: samson.SBRenderPreset, color: samson.SBColor) None#

Sets the background bottom color.

setBackgroundTopColor(self: samson.SBRenderPreset, color: samson.SBColor) None#

Sets the background top color.

setBondRadius(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the bond radius.

setConstantAtomRadius(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the constant atom radius.

setDepthOfFieldDistance(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the distance at which the depth-of-field effect begins.

setFirstLightColor(self: samson.SBRenderPreset, color: samson.SBColor) None#

Sets the first light’s color.

setFogFarDistance(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the distance at which fog becomes maximal.

setFogNearDistance(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the distance at which fog begins.

setGridRadius(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the grid radius.

setGridSpacing(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the grid spacing.

setGridThickness(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the grid thickness.

setSecondLightColor(self: samson.SBRenderPreset, color: samson.SBColor) None#

Sets the second light’s color.

setShadowOffset(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the offset between objects and their shadows.

setSilhouetteColor(self: samson.SBRenderPreset, color: samson.SBColor) None#

Sets the silhouette color.

setSilhouetteDistanceThreshold(self: samson.SBRenderPreset, arg0: samson.SBQuantity.unitsSI) None#

Set the silhouette distance threshold. A pixel is considered to be part of the silhouette if the difference between the depth of one of its neighbors and its own depth is larger than this parameter.

toString(self: samson.SBRenderPreset, offset: int = 0) str#

Returns a string representation of the render preset with the full information on all the options

BestSpeed = <AntiAliasingPreset.BestSpeed: 0>#
BetterSpeed = <AntiAliasingPreset.BetterSpeed: 1>#
Black = <BackgroundType.Black: 2>#
ContainedInViewport = <BackgroundImageMode.ContainedInViewport: 0>#
CoveringViewport = <BackgroundImageMode.CoveringViewport: 1>#
Custom = <ShadowPreset.Custom: 4>#
Default = <LightingPreset.Default: 0>#
property FXAAFlag#

The Fast Approximate Anti-Aliasing (FXAA) slightly slows down rendering but greatly reduces aliasing artefacts (jagged edges).

FlatLight = <LightingPreset.FlatLight: 1>#
HighQuality = <ShadowPreset.HighQuality: 2>#
HigherQuality = <AntiAliasingPreset.HigherQuality: 2>#
HighestQuality = <AntiAliasingPreset.HighestQuality: 3>#
Image = <BackgroundType.Image: 4>#
LowQuality = <ShadowPreset.LowQuality: 0>#
MediumQuality = <ShadowPreset.MediumQuality: 1>#
property OSAOFlag#

Whether the object-space ambient occlusion (OSAO) is on or off.

Ambient occlusion improves the perception of depth in molecules, by simulating the fact that deeper regions are less accessible to light and are thus darker.

Object-space ambient occlusion (OSAO) is more realistic, but slower. Adjust the strength (OSAOStrength) of the effect to make objects lighter or darker.

property OSAOGridSize#

The precision of the ambient occlusion effect (higher is better and slower)

property OSAOStrength#

The strength of the ambient occlusion term.

property SSAOFlag#

Whether the screen-space ambient occlusion (SSAO) effect os on or off.

Ambient occlusion</b> improves the perception of depth in molecules, by simulating the fact that deeper regions are less accessible to light and are thus darker.

Screen-space ambient occlusion (SSAO) efficiently provides an approximate simulation, but is sensitive to the distance to the camera. Adjust the strength (SSAOStrength) of the effect to make objects lighter or darker.

property SSAOKernelSize#

The kernel size influences the quality (higher is better and slower).

property SSAORadius#

The size of the potentially occluding region. Larger radii emphasize larger structures.

property SSAORandomization#

A randomization term to smooth the ambient occlusion effect.

property SSAOStrength#

The strength of the ambient occlusion term.

SoftShadow = <ShadowPreset.SoftShadow: 3>#
property UUID#

The render preset’s UUID.

White = <BackgroundType.White: 1>#
property ambientLight#

The global light’s ambient light.

property antiAliasingMultisamplingFactor#

The multisampling factor of anti-aliasing (MSAA) determines how many pixels are actually computed for each rendered pixel (higher is better and slower).

property antiAliasingPreset#

The anti-aliasing preset (better is slower).

property atomRadiusRatioToVanDerWaalsRadius#

The default atom size proportional to Van der Waals radius.

property backgroundImageBase64#

The background image in base64.

property backgroundImageMode#

The background image mode.

property backgroundType#

The background type.

property bloomFlag#

The bloom rendering option produces highlights on the brightest parts of the image.

property bloomRadius#

The bloom radius.

property bloomStrength#

The bloom strength.

property bloomThreshold#

The bloom threshold.

property constantAtomRadiusFlag#

If True then render atoms with a constant atom radius, else render atoms with the atom size proportional to Van der Waals radius.

property defaultAmbientLight#

The global light’s default ambient light.

property defaultAtomRadiusRatioToVanDerWaalsRadius#

The default atom size proportional to Van der Waals radius.

property defaultBloomRadius#

The default bloom radius.

property defaultBloomStrength#

The default bloom strength.

property defaultBloomThreshold#

The default bloom threshold.

property defaultDepthOfFieldStrength#

The default strength of the depth-of-field effect.

property defaultFirstLightIntensity#

The first light’s default intensity.

property defaultFirstLightLatitude#

The first light’s default latitude.

property defaultFirstLightLongitude#

The first light’s default longitude.

property defaultFirstLightSpecularIntensity#

The first light’s default specular intensity.

property defaultFirstLightSpecularPower#

The first light’s default specular power.

property defaultFogStrength#

The default steepness of the fog interpolation.

property defaultFresnelIntensity#

The global light’s default fresnel intensity.

property defaultFresnelPower#

The global light’s default fresnel power.

property defaultGridTransparency#

The default grid transparency.

property defaultOSAOGridSize#

The default value of the OSAO grid size.

property defaultOSAOStrength#

The default value of the OSAO strength.

property defaultPinholeSharpness#

The default pinhole sharpness.

property defaultSSAOKernelSize#

The default value of the SSAO kernel size.

property defaultSSAORadius#

The default value of the SSAO radius.

property defaultSSAORandomization#

A default value of the SSAO randomization.

property defaultSSAOStrength#

The default value of the SSAO strength.

property defaultScalePasses#

The scale’s default minimum lengths, in pixels.

property defaultScaleThickness#

The default scale thickness, in pixels.

property defaultSecondLightIntensity#

The second light’s default intensity.

property defaultSecondLightLatitude#

The second light’s default latitude.

property defaultSecondLightLongitude#

The second light’s default longitude.

property defaultSecondLightSpecularIntensity#

The second light’s default specular intensity.

property defaultSecondLightSpecularPower#

The second light’s default specular power.

property defaultShadowMultisamplingFactor#

The shadow’s default multisampling factor.

property defaultShadowResolution#

The default resolution of shadow.

property defaultShadowSpread#

The default spread of shadow.

property defaultShadowTransparency#

The default shadow transparency.

property defaultSilhouetteThickness#

The default silhouette thickness, in pixels.

property defaultSilhouetteTransparency#

The default silhouette transparency.

property depthOfFieldFlag#

This effect simulates the depth-of-field effect produced by actual cameras (e.g. blurred distant objects). If enabled, when you zoom in the molecule its distant parts will be blurred.

property depthOfFieldStrength#

The strength of the depth-of-field effect.

property firstLightIntensity#

The first light’s intensity.

property firstLightLatitude#

The first light’s latitude.

property firstLightLongitude#

The first light’s longitude.

property firstLightSpecularIntensity#

The first light’s specular intensity. The intensity of the light reflection on surfaces. High values make surfaces look like plastic, while low values make surfaces look matte.<br><br>Changes from 0 to 1.

property firstLightSpecularPower#

The first light’s specular power. The decay of specular reflection. High values produce sharper specular reflections and make materials look shinier.

property fogFlag#

Fog makes distant objects less visible - it attenuates distant parts by blending them progressively with the background. Turn it on to make it easier to focus on the foreground.

The near and far distances are based on the camera location and determine where the fog is enabled.Before the near distance there is no fog, after the far distance every node is invisible.

The strength parameter influences the speed at which the fog is appearing or, in other words, the steepness of the fog interpolation.

property fogStrength#

The steepness of the fog interpolation.

property fresnelIntensity#

The global light’s fresnel intensity. Fresnel intensity influences how much light is reflected at grazing angles (higher is stronger).

property fresnelPower#

The global light’s fresnel power. Fresnel power influences how materials reflect light at grazing angles (lower decreases the influence of the angle).

property gridFlag#

The grid can provide an indication of the objects sizes, and can help when constructing molecular systems.

property gridTransparency#

The grid transparency.

property isCustomBackground#

A convenience function that return true if the custom gradient background is chosen.

property isImageBackground#

A convenience function that return true if the image background is chosen.

property lightingPreset#

The lighting preset.

property pinholeFlag#

The pinhole effect makes objects less visible when they are far from the center of the viewport.

property pinholeSharpness#

The pinhole sharpness.

property renderMultipleBondsFlag#

If True then render multiple bonds explicitly (default), else the order of a bond is represented by its thickness.

property scaleFlag#

The scale, shown in the bottom right part of the viewport, provides an indication of the objects sizes in the plane of the camera, i.e. the plane containing the camera target.

property scalePasses#

The scale’s minimum lengths, in pixels.

property scaleThickness#

The scale thickness, in pixels.

property secondLightIntensity#

The second light’s intensity.

property secondLightLatitude#

The second light’s latitude.

property secondLightLongitude#

The second light’s longitude.

property secondLightSpecularIntensity#

The second light’s specular intensity. The intensity of the light reflection on surfaces. High values make surfaces look like plastic, while low values make surfaces look matte.<br><br>Changes from 0 to 1.

property secondLightSpecularPower#

The second light’s specular power. The decay of specular reflection. High values produce sharper specular reflections and make materials look shinier.

property shadowFlag#

Shadow are particularly helpful to improve the perception of relative positions.

Note: on old graphics card you may want to either disable shadow or choose the lowest preset.

property shadowMultisamplingFactor#

The shadow’s multisampling factor (higher is better and slower).

property shadowPreset#

The preset for rendering shadow (better is slower).

property shadowResolution#

The resolution of shadow (higher is better and slower).

property shadowSpread#

The spread of shadow (higher is softer).

property shadowTransparency#

The shadow transparency.

property silhouetteFlag#

Silhouettes make it easier to separate regions with different depths.

property silhouetteFogAttenuationFlag#

Whether fog attenuates silhouettes of distant objects.

property silhouetteThickness#

The silhouette thickness, in pixels.

property silhouetteTransparency#

The silhouette transparency.