newbie:how to create vertex list from 3d model

Started by ug02070, November 14, 2004, 22:04:47

Previous topic - Next topic

ug02070

hi, i am a newbie to lwjgl and im wondering how i can export a model from milkshake or such applications as a text file containing the vertices of the triangles so that i can load in the 3d model by using something similar to lesson 10 of nehe where he creates a 3d world using triangles.
thanx in advance to all who reply
Danny :)

ug02070

ps is this the best way to load in models. what i'm doing is creating a space invaders game in 3d and i need to have several rows of the same 3d model, can anyone wiht experience of such things plz comment as to what is the best way to do this
thanks

ug02070

ps i do have 3ds max as well as milkshake, just not sure which is best to use

Niels

Don't know about milkshake, but in Max you can use the build-in MAXScript to easily access the datastructures containing your geometry data.

MAXScript as a language sucks pretty bad (as do all loosely typed script languages), but it does allow you to change your export code on the fly, which is nice when fooling around with various ideas, and you don't need much code at all to get basic geometry data out.

I use XML because it is structured and simple to parse, but whatever rocks your boat. Text is fine, you can always go binary later if needed.

ug02070

the thing is i have not found exactly which model i want to use yet so i dont know what format it will be in so i thought if i can outout as a series of triangles in a text document,which is what is the input i think for lesson 10 of nehe, then i'm hoping that i could use his code to load in a 3d model of an alien.
any replies or improvements will be greatly greatly appreciated
:)


spasi

Somekind of custom binary format, would be the most efficient choice. It would be fast and just the thing for your needs.

The usual recommendation is serializing objects to files, which should be the fastest way to read/write binary data (since you're going to use objects anyway to store it). But, depending on your needs, you may want to read/write plain data only, so that you can decide at runtime which parts you actually need (and load only that). For example, your vertices may contain tangent data, but say you are currently running on a crappy card with no bump mapping capabilities, so tangents aren't necessary.

ug02070

thanks for the reply but i am a newbie and none of that made any sense :(
just looking to get a model and its texture out of 3d studio max and into an opengl window using lwjgl
thanks :)

Matzon


ug02070

funny, i have just opened up that site as you sent the reply:)
thanks for replying though

napier

Not sure what you want to achieve exactly.  If you just want to load a model then you're probably better off working with an existing format (ie. 3DS) instead of creating your own format.

I replied to your other post as well, which seems to be closely related to this one.  You could take a look here for examples of 3DS model loading using a java library:

  http://potatoland.com/code/gl

Look at code in "Basic Scene"
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

ug02070

thanks but decided to use raw files now and parse them into my lwjgl code
thanks