Adds trails that follow the terrain surface. Trails use
lightweight rgl line previews while caching solid meshes for
render_highquality(). Each input line is meshed independently, without
road grades, lanes, layer rules, intersection solving, or mesh joining.
Spatial line data used to draw trails. Supports sf, sfc,
sfg, SpatialLines, and SpatialLinesDataFrame line inputs.
Default "grey50". Trail color.
Default 1. Trail width in the units selected by width_units.
Default NULL. Column name in an sf trail object used
to set per-feature trail widths. Values must be positive finite numbers and
use the same units as width.
Default "scene". Units used by width and
width_column. "scene" uses scene grid-cell units; "meters" converts
physical widths using the scene extent and CRS.
Default TRUE. Whether to densify trails and resample them
along the terrain before meshing.
Default NULL. Vertical trail centerline offset in elevation
units. When NULL, the mesh is centered on the terrain surface.
Default 0.05. Total solid mesh thickness in scene units.
Default TRUE. Whether to remove the existing trail
layer before drawing the new one. A clear-only call returns without drawing
a replacement.
Default "line". Whether trails are drawn in rgl as
lightweight "line" previews or as their cached "mesh" geometry. Both
options use the solid mesh in render_highquality().
Default FALSE. Whether to show native meshing progress.
Default TRUE. Whether to build independent trail meshes in
parallel with the native job queue.
Default 1. Ratio between horizontal spacing and elevation
units. If omitted for a spatial raster scene, rayshader uses its resolution.
Default 1. Multiplier applied to the effective
visual relief. If omitted, rayshader uses the active scene value.
Default NULL. Height matrix or spatial raster for the
current scene. If omitted, rayshader uses the active scene heightmap.
Invisibly returns the independently meshed trail coordinates.
volcano_dem = volcano_spatial()
volcano_dem |>
height_shade() |>
plot_3d()
render_trails(
volcano_trails,
color = "grey50",
width = 3,
width_units = "meters"
)
render_camera(theta=-33,phi=40,zoom=0.4)
# RGL render uses lines for speed
render_snapshot()
# High quality render uses mesh trail
render_highquality(samples=16)
# RGL preview can be set to use (potentially slower) mesh preview
render_trails(
volcano_trails,
color = "grey50",
width = 3,
width_units = "meters",
preview="mesh",
clear_previous = TRUE
)
render_snapshot()