Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

render_preview

Render Preview


Description

Takes the scene description and renders an image, either to the device or to a filename.

Usage

render_preview(..., light_direction = c(0, -1, 0), exponent = 6)

Arguments

...

All arguments that would be passed to 'render_scene()'.

light_direction

Default 'c(0,-1,0)'. Vector specifying the orientation for the global light using for phong shading.

exponent

Default '6'. Phong exponent.

Value

Raytraced plot to current device, or an image saved to a file.

Examples

generate_ground(material=diffuse(color="darkgreen")) %>% 
  add_object(sphere(material=diffuse(checkercolor="red"))) %>% 
  render_preview()
  
#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))
  
#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)

rayrender

Build and Raytrace 3D Scenes

v0.21.2
GPL-3
Authors
Tyler Morgan-Wall [aut, cph, cre] (<https://orcid.org/0000-0002-3131-3814>), Syoyo Fujita [ctb, cph], Melissa O'Neill [ctb, cph], Vilya Harvey [ctb, cph]
Initial release
2021-04-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.