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

generate_ground

Generate Ground


Description

Generates a large sphere that can be used as the ground for a scene.

Usage

generate_ground(
  depth = -1,
  spheresize = 1000,
  material = diffuse(color = "#ccff00")
)

Arguments

depth

Default '-1'. Depth of the surface.

spheresize

Default '1000'. Radius of the sphere representing the surface.

material

Default diffuse with 'color= "#ccff00"'.The material, called from one of the material functions diffuse, metal, or dielectric.

color

Default '#ccff00'. The color of the sphere. Can be either a hexadecimal code, or a numeric rgb vector listing three intensities between '0' and '1'.

Value

Single row of a tibble describing the ground.

Examples

#Generate the ground and add some objects
scene = generate_ground(depth=-0.5,
                        material = diffuse(noise=1,noisecolor="blue",noisephase=10)) %>%
  add_object(cube(x=0.7,material=diffuse(color="red"),angle=c(0,-15,0))) %>%
  add_object(sphere(x=-0.7,radius=0.5,material=dielectric(color="white")))

render_scene(scene, parallel=TRUE,lookfrom=c(0,2,10))


# Make the sphere representing the ground larger and make it a checkered surface.
scene = generate_ground(depth=-0.5, spheresize=10000,
                        material = diffuse(checkercolor="grey50")) %>%
  add_object(cube(x=0.7,material=diffuse(color="red"),angle=c(0,-15,0))) %>%
  add_object(sphere(x=-0.7,radius=0.5,material=dielectric(color="white")))

render_scene(scene, parallel=TRUE,lookfrom=c(0,1,10))

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.