text3d_mesh | R Documentation |
Text Object
text3d_mesh(
label,
position = c(0, 0, 0),
text_height = 1,
orientation = "xy",
font_color = "black",
font_size = 100,
font = "sans",
font_lineheight = 12,
background_color = "white",
background_alpha = 0,
angle = c(0, 0, 0),
pivot_point = c(0, 0, 0),
order_rotation = c(1, 2, 3),
scale = c(1, 1, 1)
)
label |
Text string. |
position |
Default |
text_height |
Default |
orientation |
Default |
font_color |
Default |
font_size |
Default |
font |
Default |
font_lineheight |
Default |
background_color |
Default |
background_alpha |
Default |
angle |
Default |
pivot_point |
Default |
order_rotation |
Default |
scale |
Default |
List describing the mesh.
if(run_documentation()) {
#Generate a label in the Cornell box.
generate_cornell_mesh() |>
add_shape(text3d_mesh(label="Cornell Box", position=c(555/2,555/2,555/2),angle=c(0,180,0),
text_height=120)) |>
rasterize_scene(light_info = directional_light(c(0.1,0.4,-1)))
}
if(run_documentation()) {
#Change the orientation
generate_cornell_mesh() |>
add_shape(text3d_mesh(label="YZ Plane", position=c(540,555/2,555/2),text_height=180,
orientation = "yz",angle=c(0,180,0))) |>
add_shape(text3d_mesh(label="XY Plane", position=c(555/2,555/2,540),text_height=180,
orientation = "xy", angle=c(0,180,0))) |>
add_shape(text3d_mesh(label="XZ Plane", position=c(555/2,15,555/2),text_height=180,
orientation = "xz", angle=c(0,180,0))) |>
rasterize_scene(light_info = directional_light(c(0.1,0.4,-1)))
}
if(run_documentation()) {
#Add an label in front of a sphere and change the font
generate_cornell_mesh() |>
add_shape(text3d_mesh(label="Cornell Box", position=c(555/2,555/2,555/2),text_height=180,
font = "Serif", font_color="orange",
angle=c(0,180,0))) |>
add_shape(text3d_mesh(label="Sphere", position=c(555/2,130,100),text_height=100,
font = "sans",
font_color="lightblue",angle=c(0,180,40))) |>
add_shape(sphere_mesh(radius=100,position=c(555/2,100,555/2),
material=material_list(diffuse="purple",type="phong"))) |>
rasterize_scene(light_info = directional_light(c(0.1,0.4,-1)))
}
if(run_documentation()) {
#A room full of b's
set.seed(1)
bee_scene = list()
for(i in 1:100) {
bee_scene = add_shape(bee_scene, text3d_mesh("B", position=c(20+runif(3)*525),
font_color="yellow", text_height = 100,
angle=c(0,180,0)))
}
generate_cornell_mesh() |>
add_shape(bee_scene) |>
rasterize_scene(light=directional_light(c(0,1,-1)))
}
if(run_documentation()) {
#A room full of bees
bee_scene = list()
set.seed(1)
for(i in 1:100) {
bee_scene = add_shape(bee_scene, text3d_mesh("\U1F41D", position=c(20+runif(3)*525),
font_color="yellow", text_height = 100,
angle=c(0,180,0)))
}
generate_cornell_mesh() |>
add_shape(bee_scene) |>
rasterize_scene(light=directional_light(c(0,1,-1)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.