A second look: CPU Cycles

Contents

Install

npm install -g @lmctl-ai/lmctl

lmvideo 0.1.38 is released. Source examples are pinned to public commit aab2677.

Download lmvideo 0.1.38

Raster is the fast preview path. The same scene can use CPU Cycles for final lighting, reflections and roughness. Use the lmvideo 0.1.38 prerelease runtime.

Save each displayed source at its named examples/book/ path before running its compile/render commands. The output below is the structured result from the locked chapter capture; timing fields describe that historical run and vary on another machine.

Run this example

lmscript examples/book/cycles-still.lms
lmvideo --lmcode build/sphere-cycles.dslb

Source

mkdir("build");
program = _lmcode_ cli="lmvideo" install="github:lmctl-ai/lmvideo@v0.1.38";

let scene = scene3d().background("#111923");
scene.camera(camera3d()
  .look_at(4.0, 2.8, 6.0, 0.0, 0.6, 0.0)
  .perspective(42.0, 0.1, 100.0));
scene.directional_light(2.0, 3.0, 4.0, "#ffffff", 2.0);
scene.add(mesh_sphere(1.0, 32, 48),
          material("#d9a441", 0.25, 0.45));

let beauty = scene.render_image(
  960, 540, "cycles", 32, 4, 42, true);
beauty.save("build/sphere-cycles.png");

end _lmcode_

Raw LMScript source

A gold sphere lit against a dark background.
A CPU Cycles still shows lighting and reflections on a curved surface.

Run this example

lmscript examples/book/cycles-turntable.lms
lmvideo --lmcode build/turntable.dslb

Source

mkdir("build");
program = _lmcode_ cli="lmvideo" install="github:lmctl-ai/lmvideo@v0.1.38";
video.size(960, 540); video.fps(24); video.frames(48);
video.output("build/turntable.mp4"); video.begin();
let scene = scene3d().background("#09111f");
scene.camera(camera3d().look_at(4.5, 2.5, 5.5, 0.0, 0.0, 0.0)
  .perspective(45.0, 0.1, 100.0));
scene.directional_light(2.0, 3.0, 4.0, "#ffffff", 2.0);
let body = scene.add(mesh_box(1.4, 1.0, 0.6),
                     material("#e76f51", 0.25, 0.45));
for (frame in range(0, video.count())) {
  video.frame();
  body.rotation(0.0, 360.0 * video.t(), 0.0);
  scene.time(video.time());
  let image = scene.render_image(
    video.width(), video.height(), "cycles", 16, 4, 42, true);
  canvas.clear("#09111f");
  canvas.image(image, 0.0, 0.0);
}
video.end();
end _lmcode_

Raw LMScript source

Forty-eight frames rendered by CPU Cycles at 24 frames per second. The still above is the chapter poster, not a frame from the clip. (2.0 seconds)

The seven render_image arguments are width, height, renderer name, samples, maximum bounces, repeatable seed and denoise. A build without Cycles must report an error rather than silently render with raster. Video generation compiles once and renders each frame; these captures are local verification evidence, not a new website benchmark run.