Add light

add_light(lights, light)

Arguments

lights

Current light scene.

light

New light to add.

Value

A matrix representing the light information.

Examples

# \dontshow{
options("cores"=1)
# }
#Add a light to scene (manually specify the light automatically added to the Cornell Box
lights = point_light(position=c(555/2,450,555/2),
                    falloff_quad = 0.0, constant = 0.0002, falloff = 0.005)
# \donttest{
generate_cornell_mesh(light=FALSE) %>% 
 rasterize_scene(light_info = lights)
#> 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’
# }
#Add directional lights and a point light
lights_d = add_light(lights, directional_light(direction=c(1,1.5,-1), intensity=0.2)) %>% 
 add_light(directional_light(direction=c(-1,1.5,-1),color="red", intensity=0.2)) %>% 
 add_light(point_light(position=c(555/2,50,555/2), color="blue", intensity=0.3,
                       falloff_quad = 0.0, constant = 0.0002, falloff = 0.005))
# \donttest{
generate_cornell_mesh(light=FALSE) %>% 
 rasterize_scene(light_info = lights_d)
#> 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’
# }