ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

EEVEEOptions

Configure the optional EEVEE renderer. Blender 4.5+ is installed separately.

python
from proteinmotion import EEVEEOptions

Constructor

python
EEVEEOptions(
    blender: str | None=None,
    samples: int=64,
    supersampling: float=1.5,
    max_blur: float=24.0,
    max_opacity_layers: int=64,
    timeout: float=180.0,
)

Parameters

ParameterDefaultDescription
blenderstr | NoneNoneOptional Blender executable path. Otherwise use PROTEINMOTION_BLENDER, PATH or the macOS application.
samplesint64Positive number of EEVEE samples per pixel; default 64.
supersamplingfloat1.5Spatial resolution multiplier of at least 1. Output is downsampled to the requested size.
max_blurfloat24.0Maximum depth-of-field blur size in output pixels.
max_opacity_layersint64Maximum distinct positive opacity levels per frame. Rendering cost grows with this count.
timeoutfloat180.0Seconds allowed for Blender startup or one frame before an error is raised.

Notes

Defaults use fixed sampling, 1.5× spatial supersampling, and scene-linear group fades. Each opacity level adds a render layer.

Attributes

NameDescription
blenderOptional Blender executable path. Otherwise use PROTEINMOTION_BLENDER, PATH or the macOS application.
samplesPositive number of EEVEE samples per pixel; default 64.
supersamplingSpatial resolution multiplier of at least 1. Output is downsampled to the requested size.
max_blurMaximum depth-of-field blur size in output pixels.
max_opacity_layersMaximum distinct positive opacity levels per frame. Rendering cost grows with this count.
timeoutSeconds allowed for Blender startup or one frame before an error is raised.

Example and output

This excerpt runs inside a scene’s construct() method. The full example file includes imports, structure loading, and camera setup. Run it from a repository checkout.

Code Full script
python
"""Calmodulin 1CLL: select a helix, fade its context, then pull lens focus.

Render with:
    proteinmotion render examples/eevee_focus.py HelixFocus --renderer eevee \
        --width 960 --height 540 --fps 60 -o helix-focus.mp4

Requires Blender 4.5+. The camera motion illustrates the deposited structure.
"""

from pathlib import Path

from proteinmotion import FocusPull, Protein, ProteinScene, SetOpacity, Text, Write

DATA = Path(__file__).resolve().parent / "data"


class HelixFocus(ProteinScene):
    def construct(self):
        protein = Protein.from_file(DATA / "1cll.cif", chains="A").cartoon(color="#7299b4").center()
        protein.rotate(0.9, axis=(0, 0, 1))
        helix = protein.select(chain="A", residues=(5, 19))
        helix.set_color("#ffb34c")
        # The context selection includes every atom outside the highlighted helix.
        context = protein.select(chain="A", residues=[4, *range(20, 149)])
        far_region = protein.select(chain="A", residues=(82, 92), atoms="CA")
        self.add(protein)
        self.camera.frame(protein, aspect=self.width / self.height).zoom(1.5)
        self.camera.set_focus(protein, chain="A", residues=(5, 19), atoms="CA", fstop=4)
        self.add(Text("Calmodulin · 1CLL", position=(0.055, 0.9), font_size=30))
        label = helix.callout(
            "Alpha helix",
            subtitle="Chain A · residues 5–19",
            position=(0.68, 0.13),
            color="#ffb34c",
            font_size=38,
        )
        self.play(Write(label), run_time=0.8)
        self.play(SetOpacity(context, 0.06), run_time=1)
        self.play(self.camera.animate.orbit(theta=0.28), run_time=2)
        self.wait(0.4)
        self.play(FocusPull(self.camera, far_region, fstop=2.8), SetOpacity(context, 0.35), run_time=1.4)
        self.wait(0.4)
        self.play(FocusPull(self.camera, helix, fstop=4), SetOpacity(context, 0.06), run_time=1.2)
        self.wait(0.8)
Output Preview · 8.0 s · 60 fps
EEVEE lens focus

Calmodulin: highlight residues 5–19, fade the surrounding cartoon, and change lens focus.