Skip to content

Instantly share code, notes, and snippets.

@mhermans
Last active October 11, 2019 11:13
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 mhermans/e619e13fa4f127b5e422c1329e52a43f to your computer and use it in GitHub Desktop.
Save mhermans/e619e13fa4f127b5e422c1329e52a43f to your computer and use it in GitHub Desktop.
generate R rayrender scene with HIVA logo
devtools::install_github('tylermorganwall/rayrender')
library(rayrender)
# generate rayrender scene with HIVA logo
generate_ground(depth=-1000, spheresize = 100000000, material = diffuse(color="#529fd3")) %>%
# H
add_object(cube(x = 0, y = 0, z = -600,
xwidth = 50, ywidth = 400, zwidth = 50, angle = c(0, 0, 0),
material = diffuse())) %>%
add_object(cube(x = 0, y = -0, z = -400,
xwidth = 50, ywidth = 400, zwidth = 50, angle = c(0, 0, 0),
material = diffuse())) %>%
add_object(cube(x = 0, y = -0, z = -500,
xwidth = 50, ywidth = 200, zwidth = 50, angle = c(90, 0, 0),
material = diffuse())) %>%
# I
add_object(cube(x = 0, y = 150, z = -275,
xwidth = 100, ywidth = 100, zwidth = 100, angle = c(0, 0, 0),
material = dielectric())) %>%
add_object(cube(x = 0, y = 0, z = -275,
xwidth = 100, ywidth = 100, zwidth = 100, angle = c(0, 0, 0),
material = dielectric(color = '#f7941e'))) %>%
add_object(cube(x = 0, y = -150, z = -275,
xwidth = 100, ywidth = 100, zwidth = 100, angle = c(0, 0, 0),
material = dielectric(color = '#bcd85f'))) %>%
# V
add_object(cube(x = 0, y = 0, z = 0,
xwidth = 50, ywidth = 400, zwidth = 50, angle = c(-15, 0, 0),
material = diffuse())) %>%
add_object(cube(x = 0, y = -0, z = -100,
xwidth = 50, ywidth = 400, zwidth = 50, angle = c(15, 0, 0),
material = diffuse())) %>%
# A
add_object(cube(x = 0, y = 0, z = 250,
xwidth = 50, ywidth = 400, zwidth = 50, angle = c(-15, 180, 0),
material = diffuse(color = "white"))) %>%
add_object(cube(x = 0, y = -0, z = 150,
xwidth = 50, ywidth = 400, zwidth = 50, angle = c(15, 180, 0),
material = diffuse())) %>%
add_object(cube(x = 0, y = -50, z = 200,
xwidth = 50, ywidth = 100, zwidth = 50, angle = c(90, 0, 0),
material = diffuse(fog = FALSE))) %>%
add_object(disk(x = 200, y = -200, z = -150, radius = 550, material = dielectric(color = "#003f7d"))) %>%
render_scene(lookfrom = c(-1000, 500, -800), lookat = c(0, 0, -250), fov = 40,
samples = 10000, parallel = TRUE, filename = 'rayrender_hiva.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment