Open apsteinmetz opened 1 year ago
I don't have the API key for the thunderforest map source, so I ran the following and did not see the same problem (the red line existed). Do you see the red line overlay when you run the following code, and do you still have this problem?
library(rayshader)
library(elevatr)
library(png)
library(sf)
library(terra)
library(raster)
library(osrm)
library(maptiles)
library(tidyverse)
start_point <- c(-74.2548014,41.0248253) # where skyline drive meets i-287
end_point <- c(-74.28869990,41.22772724) # north end of windermere ave. in Greenwood Lake
full_extent <- ext(-8278678.63106571, -8264262.03289493, 5015662.67345158, 5049556.38996736)
map_ras <- rast(extent = full_extent, crs="EPSG:3857")
gwl_route_detailed <- osrm::osrmRoute(start_point,end_point,overview = "full") |>
st_transform(crs(map_ras))
raw_elevation <- get_elev_raster(raster(map_ras),z = 12)
elevation <- raw_elevation |>
rast() |>
terra::crop(map_ras)
elev_matrix <- elevation |>
raster_to_matrix()
route_overlay <- generate_line_overlay(gwl_route_detailed,
map_ras,
# dimensions same as image overlay, otherwise jaggy
width = 1510,
height = 3549,
color = "red",
linewidth = 2)
shadow_lamb <- lamb_shade(elev_matrix)
elev_matrix |>
sphere_shade() |>
add_overlay(route_overlay) |>
plot_3d(elev_matrix,zscale = 7)
camera_coords <-
convert_path_to_animation_coords(
gwl_route_detailed,
extent = full_extent,
heightmap = elev_matrix,
zscale = 7,
resample_path_evenly = TRUE,
offset = 10,
offset_lookat = 10,
altitude = 400,
follow_camera = TRUE,
follow_distance = 100,
follow_fixed = FALSE,
follow_angle = 15,
damp_motion = TRUE,
damp_magnitude = 1,
type="bezier",
curvature_adjust = "both",
frames = 600,
)
render_highquality(animation_camera_coords = camera_coords, width=800, height=800,
samples=4, line_radius=0.5, sample_method = "sobol_blue",
ambient_light = TRUE,
filename="gwl_")
The code below produces a render with the overlay ignored. The plot_3d() window looks fine. The render is correct if curve type="cubic" OR the number of frames is "small." I don't know what the cutoff number of frames is.
Here is the first frame:
New coords with default curve type. Everything else the same.