Takes the scene description and renders an image, either to the device or to a filename.
render_preview(..., light_direction = c(0, -1, 0), exponent = 6)
Raytraced plot to current device, or an image saved to a file.
if(run_documentation()) {
generate_ground(material=diffuse(color="darkgreen")) %>%
add_object(sphere(material=diffuse(checkercolor="red"))) %>%
render_preview()
}
if(run_documentation()) {
#Change the light direction
generate_ground(material=diffuse(color="darkgreen")) %>%
add_object(sphere(material=diffuse(checkercolor="red"))) %>%
render_preview(light_direction = c(-1,-1,0))
}
if(run_documentation()) {
#Change the Phong exponent
generate_ground(material=diffuse(color="darkgreen")) %>%
add_object(sphere(material=diffuse(checkercolor="red"))) %>%
render_preview(light_direction = c(-1,-1,0), exponent=100)
}