tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.05k stars 211 forks source link

Rendering speed #91

Closed adeldaoud closed 4 years ago

adeldaoud commented 4 years ago

First of all, thanks for developing this package to produce beutiful visualization!

A) I wonder if it is normal for rayshader to take a couple of minutes before the rendering appears in a separate window?

B) Once the map is rendered, I can rotate the map with my mouse but it is very laggy. Is that expected?

I am running the following code:


library(ggplot2)
glimpse(faithfuld)

faithful_dd = ggplot(faithfuld, aes(waiting, eruptions)) +
  geom_raster(aes(fill = density)) +
  ggtitle("3D Plotting in R from 2D_ggplot_graphics") +
  labs(caption = "Package: rayshader") +
  theme(axis.text = element_text(size = 12),
        title = element_text(size = 12,face="bold"),
        panel.border= element_rect(size=2,color="black",fill=NA));  

faithful_dd

#devtools::install_github("tylermorganwall/rayshader")
library(rayshader)
plot_gg(faithful_dd, multicore = TRUE, width = 8, height = 8, scale = 300, zoom = 0.6, phi = 60, background = "#afceff",shadowcolor = "#3a4f70")
tylermorganwall commented 4 years ago

For large renders, yes--it can take that long. Try using the reduce_size argument in plot_gg() to decrease the resolution of your plot so you can preview it more quickly. You might also try and turn raytracing off by setting raytrace = FALSE in plot_gg() to skip rendering the raytraced shadows to make your 3D model appear more quickly.

tylermorganwall commented 4 years ago

And the laggy dragging is a function of the size as well--either decrease the width and height parameters, or set reduce_size to a number less than one and that will make manipulating the 3D figure more performant.