save_obj {rayshader}R Documentation

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

filename_obj = tempfile(fileext = ".obj")

#Save model of volcano

volcano %>%
 sphere_shade() %>%
 plot_3d(volcano, zscale = 2)

save_obj(filename_obj)


#Save model of volcano without texture

save_obj(filename_obj, save_texture = FALSE)
rgl::rgl.close()


#Make water have realistic index of refraction

montereybay %>%
 sphere_shade() %>%
 plot_3d(montereybay, zscale = 50)
 
save_obj(filename_obj, water_index_refraction = 1.5)
rgl::rgl.close()


[Package rayshader version 0.19.2 Index]