You can use rayshader::render_points()
. Below a fully reproducible example with a point cloud on top of a rayshaded DTM
library(lidR)
LASfile = system.file("extdata", "Topography.laz", package="lidR")
las = readLAS(LASfile)
dtm = grid_terrain(las, algorithm = tin()) # RasterLayer
bbox <- extent(dtm)
library(rayshader)
elmat = raster_to_matrix(dtm)
x = elmat %>%
sphere_shade(texture = "desert") %>%
add_water(detect_water(elmat), color = "desert") %>%
add_shadow(ray_shade(elmat, zscale = 3), 0.5)
pal <- colorRampPalette(height.colors(10))
col <- pal(30)[as.numeric(cut(las$Z, breaks = 30))]
x %>% plot_3d(elmat, zscale = 1, fov = 0, theta = 135, zoom = 0.75, phi = 45, windowsize = c(800, 800))
title3d(xlab = "X", ylab = "Y", zlab = "Z", col = "black")
render_points(extent = bbox, long = las$X, lat = las$Y, altitude = las$Z,size = 2, color = col)