[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] What 3D format do you use?



Simon Wittber wrote:
Unfortunately, I'm having some trouble finding a simple 3D model
loader for Python, which "just works".

I have written a Python package than can read a number of formats, it's available here: http://cgkit.sourceforge.net/
You could either use the kit as a framework for your entire game or simply use it to convert your models into a format that is convenient for your application.


I have an OBJ file loader which can load a model and render to an
OpenGL display list, however I am not having any success getting
textures to apply to an OBJ model. I think this may be a problem with
lightwave exporting...

What exactly are you seeing? Does the texture image appear but it's not correctly mapped on the model or don't you see the image at all?
Have you checked the texture coordinates? Are they available in the file (i.e. are there lines starting with "vt")? Does your OBJ file loader really import and apply the texture coordinates?


Anyhow, I'm curious to know what other people are using in their
games, and which 3D model file format people use and/or think is best.

That depends on your application and how you define "best" (easy to implement an importer or flexible enough so that it can store arbitrary data?). Some questions that might influence the answer are: Do you only want to store 3D geometry or also camera, lights, curves, animations, etc? What kind of geometry do you want to store (polygonal models, NURBS, subdivision surfaces)? Do you want to implement the importer yourself or do you require that there's a freely available import library? Should the format be able to store transformations or is the raw geometry enough? Should the format be able to store arbitrary primitive variables with the model or are the standard variables such as normals, texture coordinates and colors enough? What programs do you use to create your models (as these programs need to be able to export to the format)? ...and so on...
From those formats that I'm supporting in my kit, everyone has its own advantages and disadvantages. None of them are really suited for *every* needs. But if you just want to store raw 3D geometry then OBJ is fine.


Cheers,

- Matthias -