| render_scene | R Documentation |
Renders a list of meshes as a single scene using the scimesh
software renderer. Each element can be a scimesh mesh descriptor
or an rgl-style mesh (with vb/it); rgl meshes are
transparently converted.
render_scene(meshes, camera, options = render_options())
meshes |
A list of mesh descriptors. Each element is a list
with components |
camera |
A camera list from |
options |
A render options list from |
A list with components width, height, and
pixels (raw vector of RGBA values).
# Render two cubes side by side
cube1 <- generate_cuboid(c(-1.5, 0, 0), c(0.8, 0.8, 0.8), c(1, 0, 0, 1))
cube2 <- generate_cuboid(c( 1.5, 0, 0), c(0.8, 0.8, 0.8), c(0, 0, 1, 1))
cam <- camera_auto(list(cube1, cube2), direction = c(1, 1, 1))
img <- render_scene(list(cube1, cube2), cam,
render_options(width = 800, height = 600, background_color = c(1, 1, 1, 1)))
tmp_file <- tempfile(fileext = ".png")
write_png(img, tmp_file)
# Render multiple meshes together
scimesh_cube <- generate_cuboid(c(-1, 0, 0), c(0.5, 0.5, 0.5))
sphere <- generate_sphere(c(1, 0, 0), radius = 0.5, color = c(0, 1, 0, 1))
cam <- camera_auto(list(scimesh_cube, sphere), direction = c(1, 1, 1))
img <- render_scene(list(scimesh_cube, sphere), cam,
render_options(width = 400, height = 300, background_color = c(1, 1, 1, 1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.