File Exchange

image thumbnail

loadawobj

version 1.32.0.0 (696 KB) by William Harwin
Load an alias wavefront obj file into matlab.Updated Dec 2016

9 Downloads

Updated 29 Dec 2016

View License

Load an Wavefront/Alias obj style model. Will only consider polygons with 3, 4,5 or 6 vertices. Programme will, by default, ignore normal and texture data but these are available when loading into a single argument structure. It will also ignore any part of the obj specification that is not a polygon mesh, ie nurbs, these deficiencies can probably be remedied relatively easily.

Comments and Ratings (12)

deru jian

myrah naeem

jiji hr

thanks a lot, great work

andrej

work perfect. Thanks a lot.

Arturo

Very, very useful. Thanks!

I found it convenient to first go through the file just counting the number of elements to allocate the variables. It improves reading speed significantly for large models.

Really useful; thanks!

Doug Hackett

Very nice, thanks for doing this.
Found a couple of things:
- File was renamed loadawobj, but not function name inside file.
- Bug when using 'f 1//1 2//1 3//1' face format:
Replace lines 69 and 69
f1=sscanf(Lyn,'%f/%f/%f');
f1=f1([1 4 7]);
with
f1=sscanf(Lyn,'%f//%f');
f1=f1([1 3 5]);

S. Q

thanx for this great work, could u plz tell me how can I use it, I renamed the function name, but I received this msg(Undefined command/function 'loadawobj')

giulio antonutto

A great piece of code.
Few additions are required if you wish to import textures (UV) but not so much. The rest is simply brilliant.
Thanks!!!!!

William Harwin

renamed loadawobj

urs (us) schwarz

note LOADOBJ is a generic ML function! please, rename it
us

Updates

1.32.0.0

Can now handle limited colour information via the alias wave front .mtl file, polygons with up to 6 vertices and lines.

1.3.0.0

Modified to return either faces and vertices, or a structure with more of the object information.

1.2.0.0

Rewritten the processing of the faces data to be more robust. Also will return additional data in a structure if only a single output argument is given.

1.1.0.0

Documented Doug Hacketts bug, but need some test files that demonstrates the problem please.

1.0.0.0

Aparently loadobj is a matlab function (although not with our toolbox set) so renamed loadawobj

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