-
-
Save xiaodaigh/dd9ad8632bb780ed01f156c3921762c1 to your computer and use it in GitHub Desktop.
3d sun around a pole
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rayshader) | |
library(av) | |
elmat1 = matrix(0, 500, 500) | |
elmat1[200:400, 200:400] = 971.0 | |
sunangle = 33 | |
for(sunangle in 140:360) { | |
elmat1 %>% | |
sphere_shade %>% | |
add_shadow(ray_shade(elmat1,zscale=3,maxsearch = 300, sunangle = sunangle),0.5) %>% | |
plot_3d(elmat1,zscale=10,fov=0,theta=0,zoom=0.75, phi=25, windowsize = c(1000,800)) | |
render_snapshot(filename=paste0("frame",sunangle)) | |
rgl::rgl.clear() | |
print(glue::glue("{sunangle} $()")) | |
} | |
png_files <- list.files(pattern="*.png") | |
#sprintf("frame%d.png", 1: 360) | |
av::av_encode_video(png_files, 'output.mp4', framerate = 10) | |
utils::browseURL('output.mp4') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment