tylermorganwall / rayshader

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

save_obj file output over 1GB #101

Closed RussellGrayxd closed 4 years ago

RussellGrayxd commented 4 years ago

Is there any way to reduce the file output of the save_obj function? I've tried reducing all parameters and they only make the model lower quality, but not lower file size.

tylermorganwall commented 4 years ago

The save_obj function saves exactly what you have on the screen--to make the size smaller, you have to reduce the size of the original height matrix. You can do this by using the reduce_matrix_size() function to reduce the resolution of the heightmap (while maintaining the full resolution hillshade by only reducing in the call the plot_3d())

library(rayshader)
#Reduce by a factor of 1/2
heightmap %>% 
  sphere_shade() %>%
  plot_3d(reduce_matrix_size(heightmap, 1/2)) 

Similarly, if you're using plot_gg(), pass the amount you want to decrease the resolution to the argument reduce_size and it will do the same:

library(ggplot2)
#Reduce by a factor of 1/2
ggmtcars = ggplot(mtcars) +
  geom_point(aes(x=mpg,y=disp,color=cyl),size=5)

plot_gg(ggmtcars, reduce_size=0.5) 
RussellGrayxd commented 4 years ago
Thanks! --Russell J. Gray Wildlife Ecology & Conservation Consultant 0934581341   rgrayherpetology@gmail.com

https://www.rjgrayecology.com/ | | 705 alligator ranch rd. New Smyrna Beach, FL, USA. 32168 |

On Tuesday, February 25, 2020, 01:53:04 a.m. GMT+7, tylermorganwall <notifications@github.com> wrote:  

Closed #101.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.