Previews a scene-attached camera without writing image files.
preview_camera(
scene,
camera = NULL,
width = 800,
height = 800,
fps = 24,
samples = 1,
...
)Scene containing cameras.
Default `NULL`. Camera name or `ray_camera` object to preview.
Default `800`. Preview width, in pixels.
Default `800`. Preview height, in pixels.
Default `24`. Intended preview frame rate for animated cameras.
Default `1`. Number of samples per pixel for the preview.
Additional arguments passed to `render_scene()`.
Invisibly returns the rendered preview result.
#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)