preview_camera: Preview Camera

View source: R/camera.R

preview_cameraR Documentation

Preview Camera

Description

Previews a scene-attached camera without writing image files.

Usage

preview_camera(
  scene,
  camera = NULL,
  width = 800,
  height = 800,
  fps = 24,
  samples = 1,
  ...
)

Arguments

scene

Scene containing cameras.

camera

Default 'NULL'. Camera name or 'ray_camera' object to preview.

width

Default '800'. Preview width, in pixels.

height

Default '800'. Preview height, in pixels.

fps

Default '24'. Intended preview frame rate for animated cameras.

samples

Default '1'. Number of samples per pixel for the preview.

...

Additional arguments passed to 'render_scene()'.

Value

Invisibly returns the rendered preview result.

Examples


#Zooming over the R logo
motion = generate_camera_motion(
  positions = list(c(0, 1, -10), c(0, 1, -2), c(0, 1, 10)),
  lookats = list(c(0, 0, 0), c(0, 0.5, 0), c(0, 0, 0)),
  fovs = c(60, 45, 90),
  frames = 24,
  type = "linear",
  damp_motion = TRUE,
  closed = TRUE
)

scene = generate_ground(material=diffuse(color="grey20")) |>
  add_object(obj_model(r_obj())) |>
  add_object(sphere(y=10,x=-10,z=-5,material=light(intensity=100))) |>
  add_camera(camera(name = "flythrough", motion = motion))

preview_camera(scene, camera = "flythrough", width = 400, height = 400)


rayrender documentation built on Sept. 16, 2026, 9:08 a.m.