The Render object

The Render object is to render atomic structure.

from ase.build import molecule
from batoms import Batoms
from batoms.render import Render
atoms = molecule('C2H6SO')
c2h6so = Batoms(label = 'c2h6so', from_ase = atoms)
c2h6so.render = Render(viewport = [1, 0, 0], engine = 'eevee')
c2h6so.get_image(output = 'images/c2h6so.png')

Parameters

  • viewport: specifies the direction of camera.

  • engine: specifies the render engine.

  • resolution

  • animation

  • gpu

  • run_render

  • transparent

  • compute_device_type

  • studiolight

You can print the parameters for render by:

>>> c2h6so.render

Engine

Three engines can be used:

BLENDER_WORKBENCH

BLENDER_EEVEE

CYCLES

Fast

Standard

Most powerfull, slow

../_images/render_workbench.png ../_images/render_eevee.png ../_images/render_cycles.png

Viewport

The viewport keyword is used to set the direction of camera.

Top

Front

Right

Other direction

[0, 0, 1]

[1, 0, 0]

[0, 1, 0]

[1, -0.3, 0.1]

../_images/render_direction_top.png ../_images/render_direction_front.png ../_images/render_direction_right.png ../_images/render_direction_any.png

Edit the studio light

The Workbench engine use the studio light instead of the lights in the scene. You can choose the following studio light

Default

basic.sl

outdoor.sl

paint.sl

rim.sl

studio.sl

../_images/studiolight_Default.png ../_images/studiolight_basic.sl.png ../_images/studiolight_outdoor.sl.png ../_images/studiolight_paint.sl.png ../_images/studiolight_rim.sl.png ../_images/studiolight_studio.sl.png
>>> h2o.render.studiolight = 'paint.sl'

To make your own studio light. Please read: https://docs.blender.org/manual/en/latest/editors/preferences/lights.html#prefs-lights-studio. Please save it, for example myown.sl, then use it by:

>>> h2o.render.studiolight = 'mywon.sl'

Other methods

  • set_direction_camera_light()

  • get_image()

  • motion_blur()