Jump to content


Photo

d3d_model_load_ext - 3d Models Importing Script


  • Please log in to reply
77 replies to this topic

#1 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 379 posts
  • Version:GM8

Posted 02 October 2006 - 10:28 PM

d3d_model_load_ext() is a script for importing models in the following file formats
  • WaveFront .obj
  • Anim8or .vtx
  • C source files .c (as exported by LithUnwrap)
  • DirectX files .x (only in ascii/non compressed)
  • 3D Studio ASCII files .asc
  • GameMaker .mod (as loaded and saved by the builtin GM3D model loading/saving routines)
to Game Maker d3d.

d3d_model_load_ext() reads all vertex, texture and normals data (if available in the file).

It has parameters to make it easier to use the model in GM, you can:
  • flip the normals
  • mirror the texture coordinates
  • set a scale (because d3d_transform_add_scaling(xy,ys,zs) distorts the normals)
(this only works for non .mod models)

Download

Download the script and demo project, .gmk
hotlink-hosted on Dropbox


Usage
Loading a model works the same way as with d3d_load_model(), with three additional parameters:

model=d3d_model_create();
d3d_model_load_ext(model, fname, flipnormals, fliptexcoords, scale);
(TODO: Make parameters optional)

The model can then be used in the Draw Event:
d3d_model_draw(model,x,y,z,texture);

Additioal Information and Licensing
d3d_model_load_ext() is a freeware script and you may well redistribute the package as it is.

Some parts of it took me hours to develop/figure out/research.
If you use it in your projects, please give credit to me like:
"Uses d3d_model_load_ext() by Paul "Master Xilo" Frischknecht"

Created for model formats as exported by LithUnwrap 1.3, but should work for files created by any exporter.
If it doesn't, try reconverting your model using the above program.

Remember that loading Game Maker's .mod 3d model format is always the fastest. Convert other formats only once and save them as .mod if possible. If you want to load .mod files even faster, check out d3d_model_load_fast.

I hope you'll find this script useful.
- Paul

Edited by Master Xilo, 21 July 2012 - 11:54 AM.

  • 2

#2 Skarik

Skarik

    GMC member

  • GMC Member
  • 1067 posts

Posted 02 October 2006 - 10:32 PM

O_O SHINY.....

Edit:

HOLY SH*T! DOES THIS LOAD FASTER THAN MOSAIC LIGHT???????!?!?!?! OR IS IT MY PC?!?!?!

Edited by Skarik, 02 October 2006 - 10:35 PM.

  • 0

#3 INl

INl

    GMC Member

  • New Member
  • 102 posts

Posted 03 October 2006 - 02:50 AM

I haven't found any problems with it... besides what I assume to be the program's limitations (in a rather detailed file... more simplistic models work perfectly).

Nice job :)
  • 0

#4 wildweststballa

wildweststballa

    GMC Member

  • New Member
  • 272 posts

Posted 03 October 2006 - 03:01 AM

This is Very good and looks Very promising. I believe it allows for more detailed models to run at a higher fps, I believe. Anyway, I have to disagree with you on one part and that is not wanting to use marzinip anymore. How do we protect are models from people stealing them cry* I still like this program, I could see myself using this for terrain. Does it supports animations?
  • 0

#5 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 379 posts
  • Version:GM8

Posted 03 October 2006 - 12:22 PM

I'll upload a demo of the future feautres soon.

EDIT: view first post

Edited by Master Xilo, 03 October 2006 - 01:34 PM.

  • 0

#6 Proffessor_gad

Proffessor_gad

    GMC Member

  • New Member
  • 757 posts

Posted 03 October 2006 - 04:25 PM

This looks quite promising. I hope you continue making things like this :) .

P.S. Game maker 6.0, needs a good 3d collissions example. So if you have some free time :lol: ......
  • 0

#7 Voxel

Voxel

    8-bit pixel

  • New Member
  • 61 posts

Posted 08 October 2006 - 04:48 AM

can you show the example of the full one?
thanks :ph34r:

Edited by Voxel, 09 October 2006 - 02:15 AM.

  • 0

#8 Darksoul

Darksoul

    3D Dude

  • New Member
  • 124 posts

Posted 10 October 2006 - 03:23 PM

this is REALLY cool it needs more attention
  • 0

#9 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 379 posts
  • Version:GM8

Posted 11 October 2006 - 07:30 AM

OK, finally I release the whole script.

See first post.
  • 0

#10 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 11 October 2006 - 11:53 PM

AWESOME JOB, this is a beautiful :GM5:
  • 0

#11 abacus

abacus

    GMC Member

  • New Member
  • 1330 posts

Posted 14 October 2006 - 12:26 AM

sickism
  • 0

#12 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 15 October 2006 - 03:58 PM

This topic deserves more attention :D
  • 0

#13 alzable

alzable

    GMC Member

  • New Member
  • 188 posts

Posted 16 October 2006 - 07:11 AM

WOW ... this means I can finally load my 1610 vertex model! This is one of the fastest model loaders ive seen! THis certainly does deserve more attention! =D

Well done!!!

alzable
  • 0

#14 Obiki_San

Obiki_San

    GMC Member

  • New Member
  • 136 posts

Posted 16 October 2006 - 10:48 AM

Pretty Cool *smiles*

I've tested the model that came with the demo. Why is it that the .mod file is so much bigger but loads the fastest? Ah well.

Good Work.
  • 0

#15 Burntrubber9

Burntrubber9

    GMC Member

  • New Member
  • 101 posts

Posted 16 October 2006 - 11:47 PM

The reason the .mod file loads fastest is because it is the GM default. It does not require you to read any strings, pull out the data,and write it to a model. It is just written directly to a model from the data in the file.
  • 0

#16 aparoid_x

aparoid_x

    Nintendork

  • New Member
  • 228 posts

Posted 17 October 2006 - 12:04 AM

I can't get it to load my .vtx file. How can I import one, changing the code in the creation event of your example?
  • 0

#17 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 379 posts
  • Version:GM8

Posted 17 October 2006 - 03:41 PM

Controls:
Space: load a model
L: light on/off

more: see help
  • 0

#18 zyvolution

zyvolution

    GMC Member

  • New Member
  • 255 posts

Posted 26 October 2006 - 01:24 PM

I would really like to try this one but the link is dead can you please re-upload it?
  • 0

#19 Klite-GameMaker

Klite-GameMaker

    GMC Member

  • New Member
  • 7 posts

Posted 27 October 2006 - 05:01 PM

AWESOME :D But the link is down :GM5:
  • 0

#20 cambesa

cambesa

    GMC Member

  • GMC Member
  • 868 posts
  • Version:Unknown

Posted 27 October 2006 - 06:44 PM

i thought it only can import or load .d3d files...
you can make them with marzipan but.....
i dont like it that you need to make the texture again with gamemaker because gm cant load textured models...

i hope gm will make better 3d in the next version but i dont think so.
maybe a litle bit more but not so much thet it can load all models textured...
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users