Producing publication-quality images and animations

This tutorial will show you how to customize renderings and generate publication-quality images and animations in SAMSON.

Starting with SAMSON 0.6.0, the viewport can be captured by pressing F10 to easily save screenshots. Go to the Preferences panel (Edit / Preferences or SAMSON / Preferences on Mac), in the Interface / Captures section:

 

This section lets you choose the folder in which captures are saved when pressing F10, the prefix used in filenames (prefix to which is appended an integer denoting the capture index), the file format (jpg, png or bmp), and the size (custom, or a multiple of the viewport size).

The “Preserve aspect ratio” box may be checked to maintain proportions when changing the width or the height of the capture.

The “Transparent background” box may be checked to remove the background from the image when saving with the png format.

If you are not happy with the default location of captures, change it before moving to the next step.

 

Changing the default representation of structural models

In SAMSON, molecules (structural models) have a default visual representation, where atoms are represented as balls and bonds as sticks.

Load a molecule into SAMSON, for example 1YRF from the samples:

 

In the Preferences panel, go to the Rendering / Structural models section:

 

Change the default atom radius and bond radius. If the “Automatically test” check box is checked, this immediately affects the default rendering of the structural model. For example, for a 1A atom radius:

 

If you want to restore the default settings (0.3A for atoms and 0.1A for bonds), hit the Reset button.

 

Background color

The background color may be changed in the Rendering / Background section of the Preferences panel:

 

Four options are available:

  • SAMSON: the default SAMSON background
  • Black: an entirely black background
  • White: we leave this as an exercise to the reader (hint: it’s easy)
  • Custom: a gradient from a user-defined top color to a user-defined bottom color

 

Exercise

Produce a sunrise effect similar to this one:

 

Note: to our knowledge, a successful sunrise effect has never been a sufficient reason to accept a paper to a (high-impact) journal. But who knows what might happen with yours.

 

Lighting

In SAMSON, lighting can be modified in the Rendering / Lighting section of the Preferences panel:

 

This section makes it possible to control the parameters of the two point lights that illuminate the document, as well as global parameters. Each light has the following parameters:

  • Light color: click the square to change the color of the light
  • Light intensity (between 0 and 1): the intensity of the light
  • Specular intensity (between 0 and 1): the intensity of the light reflection on surfaces. High values make surfaces look like plastic, while low values make surfaces look matte.
  • Specular power (between 0 and 1000): the decay of specular reflection. High values produce sharper specular reflections.
  • Longitude and latitude control the position of the light.

The first light is typically the main light, which is thus typically brighter than the second light (a “back light”).

Finally, three more parameters are global:

  • Fresnel intensity (between 0 and 1): the amount of background light reflected at grazing angles
  • Fresnel power (between 0 and 100): how fast the Fresnel effect decays
  • Ambient light: the amount of light that reaches objects, even when the intensity of both lights is set to 0.

Try changing all parameters and see the impact on rendering.

Exercise

Modify the background, light and global parameters to produce the following “flat” rendering:

(hint: the perception of volume is caused by lights – ambient light comes from all around).

Note that the image above is produced with ambient occlusion (see below). In case ambient occlusion is not active, your result might appear even flatter.

 

Color schemes

In SAMSON, structural nodes can be applied color schemes to modify the colors of atoms and bonds. Three types of color schemes are available:

  • Constant: the same color is uniformly applied
  • CPK: the classic Corey-Pauling-Koltun color scheme
  • Per attribute: the color is determined based on an atom attribute (e.g. temperature factor, residue, etc.)

When a color scheme is applied to a node, all the node’s descendants are affected.

Select 1YRF in the document, and first apply a constant color scheme (right click / Set color / Constant…):

 

Then, use Set color / Per attribute / Temperature factor to produce the following image:

 

Finally, reset the color scheme (Set color / Reset) to go back to the default color scheme.

 

Visual models

In SAMSON, visual models provide alternate visual representations of structural models, or even arbitrary shapes, that may be displayed in the viewport.

Visual models may be added from the Visualization menu: Visualization / Add visual model. A pop-up menu appears to choose the name of the visual model and its type:

 

Important: when a new visual model is added to the document, it is applied to the current selection. If nothing is selected, it is applied to the whole document.

Deselect all (or select 1YRF), and add a Secondary structure visual model to the document. Then hide the structural model:

 

Provided they handle them, visual models may be applied color schemes. This is the case of the secondary structure visual model (when no color scheme is applied, a rainbow color scale is used, as in the picture above).

Select the visual model, and it by secondary structure type. You should obtain the following image:

 

Exercise

Add more visual models to the document. Remember that it might be possible to find more visual models from SAMSON Connect.

 

Special effects

Several rendering effects may be applied from the Preferences panel.

Ambient occlusion

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. Two types of ambient occlusion are handled in SAMSON. Screen-space ambient occlusion, and object-space ambient occlusion. Screen-space ambient occlusion efficiently provides an approximate simulation, but is sensitive to the distance to the camera. Object-space ambient occlusion is more realistic, but slower. Even screen-space ambient occlusion is very useful to improve depth perception however. Here is 1FFK without ambient occlusion:

 

And here it is with ambient occlusion:

 

Anti-aliasing

 

Anti-aliasing removes jagged edges from images, and may significantly improve rendering. Without anti-aliasing, edges are very visible (zoom x 3):

 

With FXAA and multisampling set to 2, though, edges are much smoother, and pixel boundaries are much less visible, even at zoom x 3:

 

Fast Approximate Anti-Aliasing (FXAA) is typically very efficient, and can be activated on most recent graphics cards. Another possibility is to perform multisampling: for each pixel, f x f times more pixels are actually computed, where f is the multisampling factor. For large multisampling factors, this requires graphics cards with sufficient memory.

 

Depth-of-field rendering

 

This effect simulates the depth-of-field effect produced by actual cameras (e.g. blurred distant objects). Turn it on and zoom on the molecule to blur distant parts:

 

Fog

Fog attenuates distant parts by blending them progressively with the background. Turn it on to make it easier to focus on the foreground. Here is 1YRF again with both depth-of-field and fog:

 

Shadows

 

Shadows are particularly helpful to improve the perception of relative positions. Without shadows, it may be difficult to perceive the relative position of 1YRF to the graphene sheet behind it:

 

With shadows, however, this becomes much easier:

 

Silhouettes

 

Silhouettes make it easier to separate regions with different depths. Turn on silhouettes to produce clearly delineated structures:

 

 

 

 

Final exercises

Try to produce the following images.

PDB code 3J27 :

 

PDB code 1EQZ :

 

 

Competition

If you feel ready, produce your best image and send it to contact[at]samson-connect.net. Votes are open here.

 

 

Comments are closed