File Exchange

image thumbnail

readObj

version 1.0.0.0 (1.68 KB) by Bernard Abayowa
readObj file into Matlab structure

69 Downloads

Updated 28 Feb 2008

View License

This function reads vertices, faces, texture and normal information from a specified Obj file, and stores the information in a Matlab structure. This file is designed for faces with 3 vertices (Triangulated mesh).

Comments and Ratings (12)

i dont have readObj in my toolbox how can i add it ? thank you for help

chaolu yuan

GSCH

For making it work with arbitrary number of vertexes do the following change:
% f.v = [f.v; fv]; f.vt = [f.vt; fvt]; f.vn = [f.vn; fvn];
f.v{p} = fv;
f.vt{p} = fvt;
f.vn{p} = fvn;
p = p + 1;

qiyuhao7

It meet bug when I use face data like

f 531//1262 534//1265 539//1218

simply work!
Thank you very much...

Neat. Works well.

David

Binh Nguyen

Simple and efficient code. Note that the code work with faces with arbitrary number of vertices also (not just 3 like the author's description).

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux