Returns the spatial and 3D coordinate metadata cached for the
active scene created by plot_3d() or plot_gg(). This provides the
information needed to transform user data or size procedural geometry to the
rendered terrain without reaching into rayshader's internal cache.
The returned extent_3d uses conventional spatial axes: x, y, and elevation
z in the cached heightmap's units. For plot_3d() these are the input
elevation units; plot_gg() may use a transformed height scale.
scene_bounds uses rgl axes: x, vertical y, and horizontal z. Spatial y
increases toward negative scene z. To obtain scene y, divide the source
elevation by effective_zscale. In a curved scene, also subtract the
local drop below the tangent plane at the center of the extent.
get_scene_metadata(include_heightmap = FALSE)A named list containing:
scene_id: The active rgl scene identifier.
plot_type: Either "plot_3d" or "plot_gg".
extent: The cached x/y extent, or NULL when there is no single extent.
extent_3d: The x/y extent plus zmin and zmax elevation bounds.
crs: The scene coordinate reference system, when available.
zscale, vertical_exaggeration, and effective_zscale: The cached base
elevation scale, relief multiplier, and their effective ratio.
heightmap_dimensions, elevation_range, and scene_elevation_range:
Terrain matrix dimensions and vertical bounds in input and scene units.
scene_bounds, scene_center, and scene_dimensions: Terrain bounds,
center, and size in rgl x/y/z coordinates.
geographic_aspect: Cached horizontal aspect and physical cell metadata.
meters_per_scene_unit and map_units_per_scene_unit: Available physical
and coordinate-unit conversions for horizontal scene distances.
scene_axis_mapping: Mapping from spatial axes to rgl scene axes.
earth_curvature: Whether terrain and spatial layers follow Earth's curvature.
triangulate: Whether the terrain used mesh simplification.
panel_extents and panel_info: Cached plot_gg() panel metadata, when
applicable.
sources: Labels describing the expressions that populated core cache
values.
heightmap: The source elevation matrix when include_heightmap = TRUE, otherwise
NULL.
if (FALSE) { # interactive()
volcano_spatial() |>
height_shade() |>
plot_3d()
scene_info = get_scene_metadata()
scene_info$extent_3d
scene_info$scene_bounds
}