Monday, March 30, 2009

Wavefront OBJ Loader Open Sourced to Google Code

I have made a minor update to the Wavefront OBJ Loader and released it on Google Code. You can find its new homepage right here.

The UV texture mapping is still wonky - I haven't had time to look at that. After profiling, I realized I could save quite a bit of time by using sqrtf() instead of sqrt(), since OpenGL ES doesn't support GLDouble, there was no point in using the higher precision square root function.

I also implemented, based on some tweets by Noel Llopis of Snappy Touch fame, a faster normalization function that utilizes the fast inverse square root optimization. This is an optional optimization based on a pre-compiler define.

I really don't have any immediate plans to do much with this, but if anyone wants to work on it, I'm happy to add you as a project member. If you're interested in loading 3D objects, there's a fair amount of useful code in this project you can borrow and learn from, but there's also plenty of room for further optimizations if you feel like trying out Shark.



21 comments:

A Beautiful Mind said...
This comment has been removed by the author.
Rafael said...

Hi Jeff,

Thank you for this wonderful wavefront OBJ loader.

I found a small error in the code, so I wrote an issue in your google code project page.

Basically, it seems that you wrote glRotatef(currentPosition.z instead of glRotatef(currentRotation.z, in OpenGLWaveFrontObject.m line 278

I was wondering why my object was slightly leaning forward...

Anyway, thank you for your great work !
Rafael

Rafael said...

Hi, me again...

I found another little typo in OpenGLWaveFrontMaterial.m line 153 : I guess you meant "self.shininess = inShininess" and not " self.shininess = shininess"

Hope that will help
Rafael

David said...

Hi Jeff.

Brilliant project. Thank you.
I've downloaded the project from GoogleCode and applied some (not all) of the suggested changes from the issues logged. I've logged issue 12 myself. if you wish, I have a updated project that I can send to you.

Come back to me and I'll send you a zip file of the updated project.

Thank you again.

- David

waffelboy said...

Hello all!
Has anyone implemented fixes for the texturemapping stuff?

mraty said...

I am making my objects in Wings3D and exporting then to Wavefront format. There is slight problem with materials. Seems that my objects are rendered black.

If I first draw one of the objects that came with example project then my cube has right color. I verified this by replacing cylinder object on example project with my object.

But if I only try to draw my object then it is black. Is this loader expecting some specific mtl file format?

mraty said...

Related to my earlier post.

Problem was with textures and not disabling certain states. Posted a defect report:

http://code.google.com/p/iphonewavefrontloader/issues/detail?id=16

HeikoB said...

No Materials, yet. But have a look at obj2opengl. It's a script that converts obj files to C/C++ arrays that can be used by OpenGL ES directly: http://www.heikobehrens.net/2009/08/27/obj2opengl/

Albert said...

Thanks for the great project, could you explain how those resource files obj, mtl and pvr4 are produced, are they using same tool? blender? or using PVRTexTool? or both?

GuidoQ said...

I just downloaded the source, fire XCode on the simulator 3.0 but I get a while screen when running.

I see the objects only when I'm about to quit the app.

Any clue ?

thanks,
guido

RedJackson said...

Hi,

One IMPORTANT question,
How can is use OBJ Loader with Iphone SDK 3.0.


Thanks 4 Answer

Victor said...

I was getting a white screen after checking it out from SVN as well. To fix this all you have to do is... 1) delete nib file base name from the .plist file in resource.

2) modify main.m to be this:


int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
int retVal =UIApplicationMain(argc, argv, nil, @"Wavefront_OBJ_LoaderAppDelegate");
[pool release];
return retVal;
}

SAKrisT said...

http://www.developers-life.com/create-3d-earth.html

jiitu-ieee said...

I cant seem to find out the project on the specified link.
Can anyone please mail it to me @
yuvrajnick@gmail.com ?

ebooks said...

Hai,

Can some one help me. How to stop the animation and start the animation using other class more then one time. I am getting crashes. I can able to restart the animation multi time. But getting problem when stop the animation and again restart.

Thanks in advane

Edwin said...

scrub m65 kamagra attorney lawyer body scrub field jacket lovegra marijuana attorney injury lawyer

tigermain said...

Does anyone have an updated project archive with the issues addressed in the issue log updated?

If so could they share it or even open a new google code project as this appears to be abandoned by the developer

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels

Jethro Wilson said...

Hi

love your blog, found this post but I cannot find the source code on the link, is it possible for anybody to email me a link or attach the source code?

Thank you

mail.jetwilson@gmail.com

Luke said...

Does anyone have the source code for this project? I cant find the link to download it

Kandy said...

Its very useful application, I want to change background color to clear color, I tried by just setting GLView objects color id didn't work for me. how can I do it?