Saves triangulated meshes (FV struct, such as the output from the built-in isosurface function) as .obj files, together with the corresponding .mtl files in the current working directory.
Examples for how these functions can be used and combined to save multiple different mesh objects (with different types of material/colour definitions) into a single obj file are shown in demo_obj.m The resulting .obj and .mtl files have been uploaded as examples to poly.google.com:
The functions objwrite* make unix-specific system calls to use grep. This works for MacOS and all unix based OS, but will not run in Ms or some other OS. For systems that do not have command line "grep" available please use the functions starting with SYS in the folder systemIndependentFunnctions which use: us (2020). grep: a pedestrian, very fast grep utility (fileexchange/9647-grep-a-pedestrian-very-fast-grep-utility), MATLAB Central File Exchange. Retrieved June 12, 2020. These should work on all systems. Syntax and usage is identical to obj_write
obj_write: Saves the triangulated input mesh as a simple wavefront .obj files. No additional inputs or settings are required, only the FV struct and filename to be saved. If "filename" already exists in the current folder. FV will be added as a new additional object to "filename" (can be used to write multiple objects to the same file). If the previous file already has mtl definitions programs reading the .obj file will apply the last material to following objects (allows multiple additional objects to be added without duplicate mtl definitions).
obj_write_vertex_colors: Saves the triangulated input mesh as a wavefront .obj files with vertex colours. Additional material properties can be defined (one material for the entire mesh, colour information saved with vertex definitions). Colours can be defined by a vector and colormap 8analogous to patch) or as a Nx3 matrix of RGB values.
obj_write_manual_mtl: Saves the triangulated input mesh as a wavefront .obj files with manually defined materials. Materials can be defined manually for the entire object or for each vertex/face, giving more direct control and flexibility than obj_write_color.m. OBJ materials components (Ka, Ks, Kd, d, Ns, Ni, illum) can be defined:
obj_write_color: Writes wavefront OBJ file with user-defined face/vertex colours. Colours are defined as individual materials in the obj and corresponding .mtl files. colours can be defined as a continuous variable vector for each face/vertex or as RGB triplets. obj takes a color_vector as input (similar to the input to patch) and passes the reformatted colour data to obj_write_manual_mtl (after performing appropriate binning, resizing, and conversion to RGB colours). If "filename" already exists in the current folder. FV will be added as a new additional object to "filename". colours can be defined:
Previous versions on obj_write_color and obj_write_RGB are saved in a subfolder "old"