wcmbishop / rayshader-demo

I can rayshade, and so can you!
https://wcmbishop.github.io/rayshader-demo/
57 stars 8 forks source link

Error with render_label #11

Open adityaa1729 opened 1 year ago

adityaa1729 commented 1 year ago
elev_matrix %>% 
  sphere_shade(texture = "imhof4") %>% 
  add_water(watermap, color = "imhof4") %>%
  add_overlay(overlay_img, alphalayer = 0.5) %>%
  add_shadow(raymat, max_darken = 0.5) %>%
  add_shadow(ambmat, max_darken = 0.5) %>%
  plot_3d(elev_matrix, zscale = zscale, windowsize = c(1200, 1000),
          water = TRUE, soliddepth = -max(elev_matrix)/zscale, wateralpha = 0,
          theta = 25, phi = 30, zoom = 0.65, fov = 60) %>%
render_label(elev_matrix, x = label$pos$x, y = label$pos$y, z = 500, long= FALSE ,lat= FALSE,
             zscale = zscale, text = label$text, textsize = 2, linewidth = 5 , extent =  attr(elev_img, "extent") )

Error in if (x > nrow(heightmap) || x < 1 || y < 1 || y > ncol(heightmap) || : missing value where TRUE/FALSE needed

https://wcmbishop.github.io/rayshader-demo/ -> borrowed the code from the following blog

I dont have much experience in handling such issues. Would be very grateful, if I would have two-cent advise on this matter! :)