January 13th, 2009 — 8:47pm
The built-in COLLADA export in Blender does not support triangle strips. We are going to have to write some Python code!
As long as there is no easy path from Blender to iPhone, why not make exactly what I want?
Wish list:
- Export triangle strip verticies
- Normals
- Textures
- Colors
- Export in proprietary plist format that allows objects to be swapped in and out of memory as needed.
5 comments » | 3D, iPhone Programming
January 6th, 2009 — 10:21am
I love that part in Aliens II when Sigourney Weaver says, “We are going to need a bigger boat.” And then she tries to shoot the land shark with her rail gun.
Cocoa plists are converted from XML to an easily-parsed binary format when they are deployed. I think it may not be a dumb idea to try and convert a 3D model in COLLADA format to plist. One alternative is to somehow convert the 3D model to a giant static array. Another might be to use a different file format. The case for COLLADA/plist conversion is based on the idea that they are both XML so a style sheet can be used to do the conversion and that plists are efficient and native to Cocoa.
The first issue is memory. The iPhone does not have a lot and applications have only a little bit (about 20Mb). Assuming a giant 3D model, I am guessing that a program will not even start that tries to load its verticies, etc. from static arrays. I am sure it is possible to write a really engaging application that uses static arrays. However, I’d rather go into a project with the idea that you are going to use only the amount of memory that you need to be using right at that moment.
For example, you don’t need to load up the 3D model of the Boss Alien-Life Land Shark character (composed of 130,000 triangles) until you are going to show the Boss Alien-Life Land Shark character. So why carry BALLS around the whole time in a static array?
The next issue is efficiency. Any kind of file used to provide an application with 3D model information has to be parsed. You could probably just provide an applicaiton with one of the dozens of formats that a modeling tool will export and then parse it. If you use a plist, parsing is done for you by Cocoa (or something beneath Cocoa). The most efficient thing, of course, is just to use static arrays. A static array uses stack memory (very efficient) and needs no parsing.
I have got the COLLADA/plist solution working as a proof of concept. I will clean it up a bit and post here this week.
Next time: Aliens III: The Code
Comment » | 3D, iPhone Programming
December 10th, 2008 — 3:15pm
Someday, alien archeologists will look back at my blog and marvel at what a dipshit I was. Yep, good times.
I am writing an xml style sheet that transforms a COLLADA description of a 3D model into Apple plist XML. I can then write an Objective-C utility class that factories all my OpenGL geometry. This makes me feel less depressed about aliens from the future mocking me.
Comment » | 3D, iPhone Programming
December 2nd, 2008 — 8:00pm
Unbelievably, I think I am on the right track with my 3D application development workflow. I can’t believe people actually write software like this! It seems so archaic and inelegant. You literally need to list all the vertices for every 3D object in your program. There seems to be a minimum of three different parts: your wireframe (or vertices), “normals” that help define curved surfaces, and textures.
1 comment » | 3D, Business