ar-puuk / Population-Density-Maps

Using Kontur Population and Rayshader package in R
3 stars 1 forks source link

Rayshader package error for Plotting and Saving 2D and 3D Visualizations in R studio #1

Closed datasever closed 1 year ago

datasever commented 1 year ago

Hi, It's very nice of you to work. I have a question. I'm getting an error in the 3d plot part. the version of my packages is as follows: rayshader ---0.24.10 rayrender ---0.28.8

> {
+   start_time <- Sys.time()
+   cat(crayon::cyan(start_time), "\n")
+   if(!file.exists(outfile)) {
+     png::writePNG(matrix(1), target = outfile)
+   }
+   
+   render_highquality(
+     filename = outfile,
+     interactive = F,
+     lightdirection = 225,
+     lightaltitude = c(20, 80),
+     lightcolor = c(color[2], "white"),
+     lightintensity = c(600, 100),
+     width = 1980,
+     height = 1080,
+     samples = 300
+   )
+   
+   end_time <- Sys.time()
+   diff <- end_time - start_time
+   cat(crayon::cyan(diff), "\n")
+ }
2023-01-19 13:15:14 
Error in rayrender::obj_model(cache_filename, x = -bbox_center[1], y = -bbox_center[2],  : 
  unused argument (texture = TRUE)

I am getting error like this.

Can you help me? Thanks.

ar-puuk commented 1 year ago

Hi, I suppose the issue arises from the rayshader and rayrender packages. In the line 34-36 of the code, I have mentioned this and a way to solve it.

Basically, you will need to install the latest version of these packages from github rather than from CRAN. To do this:

install.packages("remotes") #Install the remotes packages

remotes::install_github("tylermorganwall/rayshader")
remotes::install_github("tylermorganwall/rayrender")

I am unsure if the updated package is already available in CRAN, but you could check that as well. If not, I hope this will solve the issue.

The version of rayshader I have is 0.32.7 and that of rayrender is 0.29.0.