#Generate a label in the cornell box.
if(rayrender:::run_documentation()) {
generate_cornell() %>%
add_object(text3d(label="Cornell Box", x=555/2,y=555/2,z=555/2,text_height=60,
material=diffuse(color="grey10"), angle=c(0,180,0))) %>%
render_scene(samples=128, clamp_value=10)
#Change the orientation
generate_cornell() %>%
add_object(text3d(label="YZ Plane", x=550,y=555/2,z=555/2,text_height=100,
orientation = "yz",
material=diffuse(color="grey10"), angle=c(0,180,0))) %>%
add_object(text3d(label="XY Plane", z=550,y=555/2,x=555/2,text_height=100,
orientation = "xy",
material=diffuse(color="grey10"), angle=c(0,180,0))) %>%
add_object(text3d(label="XZ Plane", z=555/2,y=5,x=555/2,text_height=100,
orientation = "xz",
material=diffuse(color="grey10"))) %>%
render_scene(samples=128, clamp_value=10)
#Add an label in front of a sphere
generate_cornell() %>%
add_object(text3d(label="Cornell Box", x=555/2,y=555/2,z=555/2,text_height=60,
material=diffuse(color="grey10"), angle=c(0,180,0))) %>%
add_object(text3d(label="Sphere", x=555/2,y=100,z=100,text_height=30,
material=diffuse(color="white"), angle=c(0,180,0))) %>%
add_object(sphere(y=100,radius=100,z=555/2,x=555/2,
material=glossy(color="purple"))) %>%
add_object(sphere(y=555,radius=100,z=-1000,x=555/2,
material=light(intensity=100,
spotlight_focus=c(555/2,100,100)))) %>%
render_scene(samples=128, clamp_value=10)
#A room full of bees
bee_list = list()
for(i in 1:100) {
bee_list[[i]] = text3d("B", x=20+runif(1)*525, y=20+runif(1)*525, z=20+runif(1)*525,
text_height = 50, angle=c(0,180,0))
}
bees = do.call(rbind,bee_list)
generate_cornell() %>%
add_object(bees) %>%
render_scene(samples=128, clamp_value=10)
}
Run the code above in your browser using DataLab