add_camera: Add Camera

View source: R/camera.R

add_cameraR Documentation

Add Camera

Description

Adds a camera to a 'ray_scene'.

Usage

add_camera(scene, camera, name = NULL, active = TRUE, replace = FALSE)

Arguments

scene

Scene to modify.

camera

Camera created with 'camera()'.

name

Default 'NULL'. Optional name that overrides 'camera$name'.

active

Default 'TRUE'. Whether to set this camera as the active scene camera.

replace

Default 'FALSE'. Whether to replace an existing camera with the same name.

Value

A modified 'ray_scene'.

Examples


scene = generate_ground(material=diffuse(color="grey20")) |>
  add_object(sphere()) |>
  add_camera(camera(
    name = "main",
    lookfrom = c(0, 1, -10),
    lookat = c(0, 0, 0),
    fov = 35
  ))

render_scene(scene, samples = 16)


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