lmblender

lmblender is Blender's Cycles path tracer as one static executable, driven by short lmscript scenes: no Blender install, no Python, no GPU. A program builds a scene through the scene context object and renders PNG, EXR, image sequences or APNG on the CPU.
Install and run
npm install -g @lmctl-ai/lmctl
lmctl https://raw.githubusercontent.com/lmctl-ai/lmblender/main/examples/cornell-box.lms
lmscript hello.lms
The first run fetches the lmblender release for the platform (Linux x64/arm64, macOS x64/arm64, Windows x64) named by install= on the block. The current release is 0.3.6.
Minimal program
mkdir("images");
prog = _lmcode_ cli="lmblender" install="github:lmctl-ai/lmblender@latest";
let ball = scene.uv_sphere(1.0, 48, 32, true);
ball.set_material(scene.material(0.1, 0.3, 0.8, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0));
scene.studio_setup();
scene.render_png("images/hello.png", 32, 640, 480);
end _lmcode_
r = run_lmcode(prog);
if (!r.ok) { println("lmblender failed"); exit(1); }
println("wrote images/hello.png");
Output directories must exist before the host runs. For renders that take minutes, save the bytecode and call the host with an explicit timeout in milliseconds, as the repository examples do:
savedsl(prog, "build/scene.dslb");
argv = dsl_cli(prog);
push(argv, "--lmcode");
push(argv, "build/scene.dslb");
r = system(argv, 3600000);
println(trim(r.stdout));
if (r.code != 0) { println(trim(f"lmblender exit {r.code}: {r.stderr}")); exit(1); }
Host protocol and flags
| Command | Effect |
|---|---|
| lmblender --version | Prints lmblender version with the DSL bytecode version, the Cycles version and the OpenImageDenoise version (or that it is disabled). Exit 0. |
| lmblender --lmcode-schema | Prints a compact summary: context and function signatures, then methods grouped by type. |
| lmblender --lmcode-schema --json | Prints the embedded schema JSON byte for byte (same bytes as schema/lmblender.dsl.json merged with the vendored std). |
| lmblender --schema --json | Older spelling of the same embedded schema output. |
| lmblender --schema | Embedded schema followed by one newline (kept for compatibility). |
| lmblender --lmcode-signatures | Prints every registered signature, one per line. Exit 0. |
| lmblender --lmcode FILE.dslb | Loads compiled bytecode, binds the scene context object, runs the program and prints one JSON result line. |
| lmblender --presets | Lists embedded scene presets as name, tab, description. |
| lmblender --preset-show NAME | Prints one embedded preset as JSON; exit 2 when the name is unknown. |
| Exit code | Meaning |
|---|---|
| 0 | Success. The run prints a JSON line with ok true and a result. |
| 2 | Usage error (wrong arguments) or unknown preset name for --preset-show. Compile failures reported by lmscript also use 2. |
| 3 | Load or run error: JSON line with ok false, phase load or run, code, message and line/column when available. |
| 4 | APP_FAIL (phase app, an unexpected host failure), or a failed write of the schema to stdout. |
Host objects and main calls
The host binds one context object, scene, of type Scene (69 methods). Mesh (18 methods) and Material (9 methods) are handles. Coordinates are right-handed and Z-up, distances are scene units, colors are linear floats in 0..1, and every call is positional.
| Area | Signatures |
|---|---|
| Primitives (Scene) | plane(float) -> Mesh; cube(float) -> Mesh; uv_sphere(float, int, int, bool) -> Mesh; cylinder(float, float, int, bool) -> Mesh; cone(float, float, int, bool) -> Mesh; torus(float, float, int, int, bool) -> Mesh; capsule(float, float, int, int) -> Mesh; tube_between(float, float, float, float, float, float, float) -> Mesh; label(string, float, float, float, float) -> Mesh |
| Imports and instances (Scene) | import_obj(string) -> Mesh; import_stl(string) -> Mesh; import_ply(string) -> Mesh; import_gltf(string) -> Mesh; instance_mesh(Mesh, float, float, float, float, float, float) -> Mesh |
| Materials (Scene) | material(float, float, float, float, float, float, float, float, float, float) -> Material; checker_material(float, float, float, float, float, float, float, float) -> Material; noise_material(float, float, float, float, float, float, float, float) -> Material; ramp_material(float, float, float, float, float, float, float, float) -> Material; image_material(string, float) -> Material; material_from_palette(string) -> Material |
| Camera (Scene) | camera_look_at(float, float, float, float, float, float, float) -> void; camera_orthographic(float, float, float, float, float, float, float) -> void; fit_camera(float) -> void; camera_dof(float, float) -> void; camera_keyframe(int, float, float, float, float, float, float, string) -> void |
| Lights and world (Scene) | studio_setup() -> void; point_light(float, float, float, float, float, float, float) -> void; sun_light(float, float, float, float, float, float, float, float) -> void; spot_light(float, float, float, float, float, float, float, float, float, float, float, float) -> void; area_light(float, float, float, float, float, float, float, float, float, float, float) -> void; world_color(float, float, float, float) -> void; sky_texture(float, float, float) -> void; environment_texture(string, float, float) -> void; ground_plane(float, float, float, float, float) -> void |
| Render (Scene) | render_png(string, int, int, int) -> void; render_exr(string, int, int, int) -> void; render_passes(string, int, int, int) -> void; render_sequence(string, int, int, int, int, int) -> void; render_apng(string, int, int, int, int, int, int) -> void; render_settings(int, int, bool) -> void; render_preset(string) -> void; render_timeout(int) -> void; set_view_transform(string) -> void; set_threads(int) -> void |
| Checks (Scene) | expect_int(int, int) -> void; version() -> string |
| Mesh | set_material(Material) -> void; set_smooth(bool) -> void; translate(float, float, float) -> void; scale(float, float, float) -> void; rotate_x(float) -> void; rotate_y(float) -> void; rotate_z(float) -> void; vertex_count() -> int; triangle_count() -> int; material_count() -> int; keyframe_transform(int, float, float, float, string) -> void; keyframe_visible(int, bool, string) -> void |
| Material | subsurface(float, float, float, float, float) -> void; volume(string, float, float, float, float) -> void; keyframe_color(int, float, float, float, string) -> void; bump(float, float, float) -> void; texture_maps(string, string, string, string) -> void; mix_with(Material, float) -> void; mix_with_texture(Material, string) -> void; backface_culling(bool) -> void; keyframe_emission_strength(int, float, string) -> void |
The standard library vendored by lmblender 0.3.6 is lmcode_std_v3 with 206 signatures (files, strings, math, Json, typed lists, maps, queues, stacks and priority queues). The current catalog has 226 including the REST and CLI interfaces, which lmblender does not ship yet.
Limits
- CPU only; point, area, spot and sun lamps are not hit by reflected or refracted rays, so use an emissive mesh when a lamp must appear in a mirror or make a caustic.
- scene.material has no IOR parameter; label text is uppercase letters and spaces only.
- Imports: OBJ/MTL, STL, ASCII PLY and glTF 2.0 triangles.
- Mesh rotation is not animated; keys cover mesh translation and visibility, camera, material colour and emission, and point-light strength.
Gallery



More
- Skill: when and how an agent should use lmblender.
- Guide: host setup, core methods, file formats and limits.
- Reference: every method, flag, exit code and std signature.
- Tutorial: grow one scene from a sphere to imported geometry and animation.
- Quickruns: task scripts for a solo Lead or a Lead, Coder and Reviewer.
- Examples: rendered scenes with runnable sources.
- github.com/lmctl-ai/lmblender