Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
Created February 1, 2022 04:34
Show Gist options
  • Save tylermorganwall/526270622ae28f21414c5f93f002192a to your computer and use it in GitHub Desktop.
Save tylermorganwall/526270622ae28f21414c5f93f002192a to your computer and use it in GitHub Desktop.
Cloud animate
library(rayshader)
montereybay2 = montereybay
montereybay2[montereybay2<0] = 0
for(i in 1:720) {
montereybay2 %>%
sphere_shade() %>%
add_water(detect_water(montereybay2), color="lightblue") |>
add_shadow(cloud_shade(montereybay2,zscale=50, sun_altitude = 90, seed=10, attenuation_coef = 1, time=i,
start_altitude = 1400, end_altitude = 1800, cloud_cover = 0.45,
offset_x = 2*i, fractal_levels = 32),0) |>
plot_3d(montereybay2,background="darkred",zscale=50, windowsize = 1000,baseshape = "circle", shadow_darkness = 0.1,
soliddepth = -50, shadowdepth = -100)
render_camera(phi=40,theta=0,zoom=0.6,fov=45)
render_clouds(montereybay2,zscale=50,seed=10,sun_altitude = 2,start_altitude = 1400, end_altitude = 1800,
clear_clouds = T, time=i,attenuation_coef=1, fractal_levels = 32, baseshape="circle", cloud_cover = 0.45,
offset_x = 2*i)
render_snapshot(title_text = r"(New in Rayshader: Add procedural clouds with `render_clouds()`)",
title_bar_color = "black", title_color="white",
filename = sprintf("proc_clouds%d.png",i))
rgl::rgl.clear()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment