Friday, July 17, 2009

Fixed & Improved Blender Export Script

The Blender Objective-C Export Script script has been updated to fix some problems, and to use interleaved data structures. There's a sample project, complete with a (cheap & dirty) texture, the source Blender project and the UV template for the ship.



It's intended to be used with my my OpenGL ES Xcode Template, as it uses data structures that are declared in OpenGLCommon.h.

This version also gives you the code you need to use to draw it, except for loading and binding the texture, although you can see from the sample project that doing that is easy if you use the OpenGLTexture2D class included with the project.

Note:The Texture2D class doesn't currently deal with the y-axis inversion problem, so flip your textures vertically before exporting.



9 comments:

Joel Bernstein said...

"The Texture2D class doesn't currently deal with the y-axis inversion problem, so flip your textures vertically before exporting."

Could there be an option to flip the texture coordinates themselves as part of the export?

Jeff LaMarche said...

that's not a bad idea. If I have time, I'll try to do that.

I do hope to deal with the inversion problem for non-PVRTC textures - I already know how to do it, but have never added the code to the class. I still don't know of a way to handle it for PVRTC textures, though.

Conor McCluskey said...

Thanks Jeff. I've been using Bill Dudney's Wavefront/Obj loader but I will be sure to give this a go when I get a chance.

Jeff LaMarche said...

Conor:

Oddly enough, Bill and I both wrote Wavefront importer code for the iPhone at exactly the same time. We actually exchanged some information in the process. It was a good learning experience for both of us, as we both had some experience with 3D graphics, but neither had done it in a long time.

Bill and I both came to the same basic conclusion, though: Wavefront is not a good file format for the iPhone, generally speaking. Since it uses surface normals, rather than vertex normals, and because it associates texture coordinates with vertex indices rather than vertices, the loading process for all but the smallest models will be slow because a lot of work needs to get done to get the data into a format OpenGL ES can use.

For most purposes, I think this approach will work better for you, But if not, you should see if Bill ever got around to writing his Collada importer. Last time I talked with him about it, he seemed to think that would be a better file format than Wavefront and he was planning on writing an importer for it. Not sure what he's done with it, though.

Jeff

Mike4Linux said...

thanks but how can i use this in Eclipse? Help is much appreciated

Tom said...

Thanks Jeff for your great tutorials, I have used your script in blender to export a model of mine and its working great. I have a question about why the texture is showing semi transparent tho???

Edwin said...

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

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

Selvam said...

Thank you very much