Learn R Programming

rayshader (version 0.13.2)

save_obj: Save OBJ

Description

Writes the textured 3D rayshader visualization to an OBJ file.

Usage

save_obj(filename, save_texture = TRUE, water_index_refraction = 1)

Arguments

filename

String with the filename. If `.obj` is not at the end of the string, it will be appended automatically.

save_texture

Default `TRUE`. If the texture should be saved along with the geometry.

water_index_refraction

Default `1`. The index of refraction for the rendered water.

Examples

Run this code
# NOT RUN {
filename_obj = tempfile(fileext = ".obj")

#Save model of volcano
# }
# NOT RUN {
volcano %>%
 sphere_shade() %>%
 plot_3d(volcano, zscale = 2)

save_obj(filename_obj)
# }
# NOT RUN {
#Save model of volcano without texture
# }
# NOT RUN {
save_obj(filename_obj, save_texture = FALSE)
rgl::rgl.close()
# }
# NOT RUN {
#Make water have realistic index of refraction
# }
# NOT RUN {
montereybay %>%
 sphere_shade() %>%
 plot_3d(montereybay, zscale = 50)
 
save_obj(filename_obj, water_index_refraction = 1.5)
rgl::rgl.close()
# }

Run the code above in your browser using DataLab