Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
Created April 8, 2021 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylermorganwall/57c99c5c611d5acdc2d23e8215f9a7d5 to your computer and use it in GitHub Desktop.
Save tylermorganwall/57c99c5c611d5acdc2d23e8215f9a7d5 to your computer and use it in GitHub Desktop.
R: 3D Rayshader/Rayrender Dataviz 360° VR Video (Earth Halo)
#You can find the surface textures at the link below:
#http://www.shadedrelief.com/natural3/pages/extra.html
#The background is just starfield image—any will do.
#Note: this uses the latest version of rayrender (0.21.4) on github
library(rayrender)
for(i in 1:360) {
group_objects(cylinder(angle=c(90,90,0), material=diffuse(image_texture = "8081_earthmap10k.jpg",
bump_texture = "8081_earthbump10k.jpg", bump_intensity = 100),
radius=12, capped = FALSE, length = 6) %>%
add_object(cylinder(angle=c(90,90,0), material=diffuse(alpha_texture = "earthcloudmap_adj.png"),
radius=11.8,capped = FALSE, length = 6)), group_angle = c(i,0,0)) %>%
add_object(sphere(materia=light(intensity = 150),x=6*sinpi(i/180))) %>%
render_scene(lookfrom=c(0,-10.0,1), lookat=c(0,-10,-1),filename=sprintf("haloearth%i.png",i),
fov=360,width=1600,height=800, environment_light = "space.png", intensity_env = 10)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment