Renders a top-down orthographic radiance pass of either the current hillshade cache, the current 3D rayshader scene, or a supplied elevation matrix.
Cache fallback messages are disabled by default. Set options(rayshader.verbose_scene_cache = TRUE) to print when cached metadata is reused.
When called with no heightmap, this function uses the cached 2D hillshade
heightmap and, when available, the cached hillshade/map texture from the most
recent rayshader hillshading chain. Set capture_scene = TRUE to instead
render the currently displayed rayshader 3D scene. When a raw matrix is
supplied, rayshader builds a temporary surface and applies texture (or a
constant color, default "grey50").
This function uses the same lighting controls as render_highquality(),
including directional lights and auto-sky generation (lat, long,
datetime, sky_sun_elevation, sky_sun_azimuth, sky_altitude, and
sky_args), and returns an RGBA array that can be passed to add_overlay().
The render runs in an isolated background R session with
RGL_USE_NULL=TRUE in the subprocess environment, and uses the standard
rayshader pipeline:
plot_3d(..., solid = TRUE, shadow = shadow) followed by
render_highquality(plot = FALSE).
radiance_shade(
heightmap = NULL,
texture = NULL,
color = "grey50",
zscale = 1,
vertical_exaggeration = 1,
filename = NA,
samples = 128,
sample_method = "sobol_blue",
min_variance = 1e-07,
shadow = TRUE,
light = TRUE,
lat = NA,
long = NA,
datetime = NA,
sky_sun_elevation = NA,
sky_sun_azimuth = NA,
sky_altitude = NA,
sky_args = list(),
light_direction = 315,
light_altitude = 45,
light_size = 5,
light_intensity = 500,
light_color = "white",
material = rayrender::diffuse(),
water_attenuation = 0,
water_surface_color = TRUE,
water_ior = 1.33,
override_material = FALSE,
cache_scene = FALSE,
reset_scene_cache = FALSE,
width = NULL,
height = NULL,
clamp_value = 1000,
auto_exposure = TRUE,
capture_scene = FALSE,
scene_elements = NULL,
plot = FALSE,
geographic_aspect = TRUE,
extent = NULL,
crs = NULL,
...
)Default NULL. If NULL, uses cached 2D hillshade metadata
by default. Set capture_scene = TRUE to use the current rayshader rgl scene.
If a matrix (or supported raster input), renders a top-down radiance pass for
that data directly.
Default NULL. Texture used only when heightmap is supplied.
Can be a rayshader-style RGB(A) array, a built-in sphere_shade() texture
name, a color vector (passed to height_shade()), an image filename, or a
single color name.
Default "grey50". Fallback single-color texture when heightmap
is supplied and texture = NULL.
Default 1. Vertical scale when heightmap is supplied.
Default 1. Multiplier applied to the effective
visual relief. If omitted while rendering from the active scene, rayshader uses
the cached scene value from plot_3d() or plot_gg() when available; pass
explicitly to override for this call. This does not update cached metadata.
Default NA. Optional output filename. If supplied, the
render is also saved to disk.
Default 128. Maximum samples per pixel.
Default "sobol_blue", unless samples > 256, in which
case it is switched to "sobol".
Default 1e-7. Adaptive sampler variance threshold.
Default TRUE. Whether to build the temporary top-down scene
with the rayshader shadow plane underneath the model. Setting this to TRUE
can help fill very dark corners in the radiance pass.
Default TRUE. Whether to add directional lights.
Default NA. Latitude used for auto sky generation.
Default NA. Longitude used for auto sky generation.
Default NA. Datetime used for auto sky generation.
Default NA. If supplied, uses
skymodelr::generate_sky() and passes this value to its elevation argument.
Default NA. If supplied, uses
skymodelr::generate_sky() and passes this value to its azimuth argument.
Default NA. If supplied, uses skymodelr::generate_sky()
and passes this value to its altitude argument.
Default list(). Extra arguments passed to
skymodelr::generate_sky_latlong() (default) or skymodelr::generate_sky()
when direct sky arguments are used.
Default 315. Light direction angle(s), in degrees.
Default 45. Light altitude angle(s), in degrees.
Default 5. Full angular diameter of the disk light(s), in degrees, greater than 0 and less than 180. Independent of scene size and camera position.
Default 500. Light intensity value(s).
Default "white". Light color(s).
Default rayrender::diffuse(). Forwarded to
render_highquality().
Default 0. Forwarded to render_highquality().
Default TRUE. Forwarded to render_highquality().
Default 1.33. Forwarded to render_highquality().
Default FALSE. Forwarded to render_highquality().
Default FALSE. Forwarded to render_highquality().
Default FALSE. Forwarded to render_highquality().
Default NULL. Output width in pixels. If omitted, derived from
the underlying surface dimensions.
Default NULL. Output height in pixels. If omitted, derived from
the underlying surface dimensions.
Default 1000. Radiance clamp value. If NA, uses 1000.
Default TRUE. Whether to use rayrender's automatic
exposure adjustment in the radiance pass. Forwarded to
rayrender::render_scene() via render_highquality() when supported by the
installed rayrender version.
Default FALSE. If TRUE and heightmap = NULL,
renders the currently displayed rayshader rgl scene instead of the cached 2D
hillshade context.
Default NULL. Extra rayrender objects to add.
Default FALSE. Whether to preview the rendered image.
Default TRUE. Correct unequal metric x/y cell
spacing in the temporary radiance scene.
Default NULL. Spatial extent for a matrix heightmap.
Default NULL. CRS to assign to the input before calculating
metric cell spacing.
Additional parameters passed to render_highquality().
Deprecated argument spellings are accepted with a warning and forwarded to their current names.
RGBA array representing the top-down radiance render.
montereybay_spatial |>
height_shade(texture = topo.colors(256)) |>
add_overlay(radiance_shade(vertical_exaggeration = 10), 1) |>
plot_map()
#Plot using sky args
montereybay_spatial |>
height_shade(texture = topo.colors(256)) |>
add_overlay(radiance_shade(vertical_exaggeration = 20,
sky_sun_elevation = 5, sky_sun_azimuth = 315), 1) |>
plot_map()