pyFM.mesh.file_utils.read_obj¶
- pyFM.mesh.file_utils.read_obj(filepath, load_normals=False, load_texture=False, load_texture_normals=False)¶
Read a .obj file containing a mesh.
- Parameters:
filepath (str) – path to the .obj file
load_normals (bool, optional) – whether to load vertex normals if present
load_texture (bool, optional) – whether to load texture coordinates if present. Reads both uv coordinates and face to texture vertex indices
load_texture_normals (bool, optional) – whether to load texture normals if present. Reads face to texture normal indices
- Returns:
vertices (np.ndarray) – (n,3) array of vertices coordinates
faces (np.ndarray) – (m,3) array of indices of face vertices, None if not present
normals (np.ndarray, optional) – Only if load_normals is True. (n,3) array of vertex normals, None if not present
uv (np.ndarray, optional) – Only if load_texture is True (n,2) array of uv coordinates, None if not present
fvt (np.ndarray, optional) – Only if load_texture is True (m,3) array of indices of face to vertex texture (vt) indices, None if not present
fnt (np.ndarray, optional) – Only if load_texture_normals is True (m,3) array of indices of face to texture normal indices, None if not present