Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
Created September 26, 2019 13:27
Show Gist options
  • Save tylermorganwall/4186e3dd2adf335f12cb0714b512ca6a to your computer and use it in GitHub Desktop.
Save tylermorganwall/4186e3dd2adf335f12cb0714b512ca6a to your computer and use it in GitHub Desktop.
A 3D render of a gilded Weedle
library(rayrender)
#Weedle 3D model: https://free3d.com/3d-model/weedle-52681.html
#Background image: https://www.tylermw.com/wp-content/uploads/2019/09/free-panorama-wallpaper-1.jpg
for(i in 1:360) {
system.time(generate_ground(material = lambertian(checkercolor = "grey50")) %>%
add_object(group_objects(obj_model("weedle.obj",y=-0.7,x=0.5,z=0.3,angle=c(0,45,0),
material = metal(color="gold",fuzz=0.1)) %>%
add_object(disk(y=-0.8,z=-0.3,material = metal(color="gold",fuzz=0.1))) %>%
add_object(cylinder(y=-0.9,z=-0.3,length=0.2,material = metal(color="gold",fuzz=0.1))) %>%
add_object(sphere(y=15, z=-10,x=10,radius=2,
material=lambertian(lightintensity = 10, implicit_sample = TRUE))),
group_angle = c(0,i,0), pivot_point = c(0,0,-0.3))) %>%
render_scene(parallel=TRUE, fov = 20, lookfrom = c(0,1.5,10), samples=400, aperture = 0.15, width=800,height=800,
backgroundimage = "free-panorama-wallpaper-1.jpg", filename = glue::glue("weedle{i}")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment