Generates a constant color layer.

Cache fallback messages are disabled by default. Set options(rayshader.verbose_scene_cache = TRUE) to print when cached metadata is reused.

constant_shade(heightmap, color = "white", alpha = 1)

Arguments

heightmap

A two-dimensional matrix, where each entry in the matrix is the elevation at that point.

color

Default "white". Color for the constant layer, as an R color name, hexadecimal code, rgb(r, g, b) string with channels from 0 to 255, or a numeric RGB vector with intensities between 0 and 1.

alpha

Default 1, the alpha transparency.

Value

RGB array of a single color layer.

Examples

#Shade a red map
montereybay_spatial |>
 constant_shade("red") |>
 add_shadow(lamb_shade(),0) |>
 plot_map()

#Shade a green map
montereybay_spatial |>
 constant_shade("green") |>
 add_shadow(lamb_shade(),0) |>
 plot_map()

#Add a blue tint
montereybay_spatial |>
 height_shade() |>
 add_overlay(constant_shade(color = "dodgerblue", alpha=0.25)) |>
 add_shadow(lamb_shade(vertical_exaggeration = 4),0) |>
 plot_map()

#Use a blank map on which to draw other data
montereybay_spatial |>
 constant_shade() |>
 add_overlay(generate_line_overlay(monterey_roads_sf, linewidth=5, color="black",
                                   width = 1080, height = 1080),
                                   alpha_layer=0.8)  |>
 add_water(detect_water(raster_to_matrix(montereybay_spatial) < 0), "dodgerblue") |>
 plot_map()