rayshader (version 0.5.1)

add_shadow: Add Shadow

Description

Multiplies a texture array or shadow map by a shadow map.

Usage

add_shadow(hillshade, shadowmap, max_darken = 0.7)

Arguments

hillshade

A three-dimensional RGB array or 2D matrix of shadow intensities.

shadowmap

A matrix that incidates the intensity of the shadow at that point. 0 is full darkness, 1 is full light.

max_darken

Default 0.7. The lower limit for how much the image will be darkened. 0 is completely black, 1 means the shadow map will have no effect.

Value

Shaded texture map.

Examples

Run this code
# NOT RUN {
#Raytrace the `volcano` elevation map and add that shadow to the output of sphere_shade()
shadowmap = ray_shade(volcano)

volcano %>%
 sphere_shade() %>%
 add_shadow(shadowmap) %>%
 plot_map()
 
#Increase the intensity of the shadow:
volcano %>%
 sphere_shade() %>%
 add_shadow(shadowmap,0.3) %>%
 plot_map()
# }

Run the code above in your browser using DataCamp Workspace