Add Shape

Add shape to the scene

add_shape(scene, shape)

Arguments

scene

The scene to add the shape.

shape

The mesh to add to the scene.

Value

Scene with shape added.

Examples

#Generate several spheres in the cornell box
# \dontshow{
options("cores"=1)
# }
scene = generate_cornell_mesh()
set.seed(1)

# \donttest{
for(i in 1:30) {
 col = hsv(runif(1))
 scene = add_shape(scene, sphere_mesh(position=runif(3)*400+155/2,
                                      material=material_list(diffuse=col, type="phong",
                                                             ambient=col,ambient_intensity=0.2), 
                                      radius=30))
}
rasterize_scene(scene, light_info=directional_light(direction=c(0.1,0.6,-1)))
#> Setting default values for Cornell box: lookfrom `c(278,278,-800)` lookat `c(278,278,0)` fov `40` .
#> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘terra’
# }