Description Usage Arguments Value Examples
Automatically plots the tree with a camera position and field of view that includes the full model. For more control over the scene, pass the scene to 'rayrender::render_scene()' and specify the camera position manually. Note: spheres and cylinders in the scene are used to automatically compute the field of view of the scene–adding additional sphere (e.g. with 'rayrender::generate_ground()') will change this calculation. Use 'rayrender::render_scene()' instead if this is a problem.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
scene |
Scene of tree model, to be passed to 'rayrender'. |
ground_radius |
Default '10'. Radius of the ground. |
ground |
Default 'TRUE'. Whether to add a grassy ground scene to the tree. |
ground_color1 |
'darkgreen'. Primary ground color. |
ground_color2 |
'lightgreen'. Secondary ground color. |
fov |
Default 'NULL', automatically calculated. Camera field of view. |
lookfrom |
Default 'NULL'. Camera position. Automatically calculated unless specified. |
lookat |
Default 'NULL'. Position camera is directed at. Automatically calculated unless specified. |
angle |
Default 'c(0,0,0)'. Degrees to rotate the tree around the X, Y, and Z axes. If this is a single number, it will be taken as the Y axis rotation. |
order_rotation |
Default 'c(1,2,3)'. What order to apply the rotations specified in 'angle'. |
lights |
Default 'TRUE'. If 'FALSE', removes all default lights. |
lightintensity |
Default '80'. Light intensity. |
clamp_value |
Default '10'. Amount of clamp the light intensity. Finite values help reduce rendering artifacts, set to 'Inf' to turn off this feature. |
width |
Default '600'. Width, in pixels, of the rendered image. |
height |
Default '600'. Height, in pixels, of the rendered image. |
... |
Other arguments to pass to rayrender::render_scene() |
Rayrender scene.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Generate a basic scene with the default tree.
library(rayrender)
generate_tree() %>%
render_tree()
#Rotate the whole scene
generate_tree() %>%
render_tree(angle = c(0,90,0))
#Specify a custom camera position/direction/field of view/aperture
generate_tree() %>%
render_tree(lookfrom = c(3, 0, 1), lookat = c(0,4,1), fov=30, aperture=1)
#Change the ground color
generate_tree() %>%
render_tree(ground_color1 = "brown", ground_color2 = "orange")
#Turn off lights and add our own
generate_tree() %>%
add_object(sphere(x=20,material=light(color="magenta",intensity=400))) %>%
add_object(sphere(x=-20,material=light(color="lightblue",intensity=400))) %>%
render_tree(lights = FALSE, clamp_value = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.