Jump to content


Photo

Xenon Core Wavefront


  • Please log in to reply
18 replies to this topic

#1 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 26 May 2008 - 03:55 PM

Hi. I would like to show you my system of loading OBJ models with information about the materials contained in MTL files.

Download: (RAR) XenoN Core WaveFront (RAR)
Download: (ZIP) XenoN Core WaveFront (ZIP)

Enjoy!

Edited by PsichiX, 27 May 2008 - 04:31 PM.

  • 0

#2 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 26 May 2008 - 04:43 PM

I have not tried it out yet, does it support the animations stored in it ?


Edit:-
This is good !! IT supports multi texturing

Edited by freko, 26 May 2008 - 04:50 PM.

  • 0

#3 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 26 May 2008 - 04:48 PM

Animation - not yet, but will soon add. If you can show me an OBJ model with built-in animation :rolleyes:
@UP: Yes, and multi alpha channel, and alpha map for textures.

Edited by PsichiX, 26 May 2008 - 04:53 PM.

  • 0

#4 freko

freko

    The Professional

  • GMC Member
  • 504 posts
  • Version:GM8

Posted 26 May 2008 - 05:25 PM

Oh no ..not obj. That was Alias FBX. Sorry :rolleyes:
  • 0

#5 chavisd00@hotmail.com

chavisd00@hotmail.com

    GMC Member

  • New Member
  • 42 posts

Posted 27 May 2008 - 03:37 PM

How exactly is this supposed to work...
Like, how do i use this?
How do i add my own objects with my own materials to this
  • 0

#6 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 27 May 2008 - 04:10 PM

Ideally, if you use Google SketchUp and export model to an OBJ file. Then upload a model with function xenon_core_wavefront_load() and draw with xenon_core_wavefront_draw()

Edited by PsichiX, 27 May 2008 - 04:15 PM.

  • 0

#7 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 27 May 2008 - 04:23 PM

Can you make a darn zip file?

winrar is crashing under vista trying to "Sign in with Windows Live ID"
  • 0

#8 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 27 May 2008 - 04:30 PM

Ok, zip version:
http://gmclan.org/up..._WaveFront.html
  • 0

#9 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 27 May 2008 - 04:54 PM

Cool stuff...

Can you load this file?

http://cid-fba0b7e57...3.obj.fixed.zip
  • 0

#10 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 27 May 2008 - 05:08 PM

Hmm.. This OBJ file structure is not available to load with wavefront loader. You must export this model using other OBJ exporter. Faces - this must be as triangles.
  • 0

#11 chavisd00@hotmail.com

chavisd00@hotmail.com

    GMC Member

  • New Member
  • 42 posts

Posted 27 May 2008 - 05:55 PM

ok, that's for the models...
what about the materials.
how do you save the materials too
  • 0

#12 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 27 May 2008 - 05:59 PM

For models and materials I used Google SketchUp - it automatically add material information (MTL) to OBJ model
  • 0

#13 chavisd00@hotmail.com

chavisd00@hotmail.com

    GMC Member

  • New Member
  • 42 posts

Posted 27 May 2008 - 06:17 PM

how do i load up the materials

Edited by chavisd00@hotmail.com, 27 May 2008 - 06:20 PM.

  • 0

#14 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14384 posts
  • Version:GM:Studio

Posted 27 May 2008 - 06:45 PM

Hmm.. This OBJ file structure is not available to load with wavefront loader. You must export this model using other OBJ exporter. Faces - this must be as triangles.


Hehehe.. I know. My model loader handles it... Took me days to figure it out.

You need to count how many point the face has.

Most commun are 3 point

x/x/x x/x/x x/x/x


But many have quads or more. Some even have a \ to tell the loader to continue reading the face point in the next line


What you do, you transform the the data into triplets yourself

in the case of a quads

1/1/1 2/2/2 3/3/3 4/4/4

you make 2 triplets

one using
1,2,3, the other using 3,4,1

in the case of a huge set like this one
f 1782//143 1781//144 1780//145 1779//146 1778//143 1781//1 1782//1 1777//147 1776//148 1775//146 \
1782//1 1777//147 1776//148 1775//146

you split into triplets
1782//143 1781//144 1780//145
1780//145 1779//146 1778//143
1778//143 1781//1 1782//1
1782//1 1777//147 1776//148
1776//148 1775//146 1782//1
1782//1 1777//147 1776//148
1776//148 1775//146 1782//143

some times you need to rewind if you are left with a single last entry like if you have 5 points, the last point must be linked to the first and either the second or the next to last point.
12345
123
345
512
or
451

Though, GM models, if you are making them, do allow changing from triplets triglelist to mutiple triangle fans right in the model definition, it's best for faster models to pre translate to triplets.

And yes, it's best to tell to exporter to convert to triplets (triangles)...

Related:
I made a exporter when I did not find, at the time, a GM program that would load a obj while keeping the texture, color and uv and alpha... or support many of the models I had got. they had quads or more..

But then I was hoping to make a blender to d3d model export. But that would be pointeless now since all the blender imports dont work LOL.

I have yet to find a obj import export for blender that actually works. In fact I have yet to find ANY blender import export that work without loosing or screwing something in the translation... It's the main reason I made an obj and .x reader... I just could not load any of the models I downloaded into blender without something getting screwed up.



The main point is, it is best to have a separate obj reader that will make a GM d3d model; it supports everything you need excect multiple textures.

Why?

Well, that house I gave you takes 45 seconds to load from a obj file... But it's loads it d3d eqivalent in no time.

In a game, when it's starts. if you load 150 models.... Can you imagine the amount of time the user would wait?




As for the textures and fast drawing, I recommend you pretranslate the obj to a d3d model, create an iterim file,
a file that has 2 entries:
texturefile.gif
gmmodel.d3d

and copy over that material texture file.




Loading a model you just need to sprite_add or sprite_add_alpha the texture and model_load the d3d file and model_draw the model using the loaded texture....

Edited by icuurd12b42, 27 May 2008 - 07:07 PM.

  • 0

#15 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 10 December 2009 - 08:41 PM

I tried this, I guess I forgot to comment.
This is Awesome! It really needs more promotion! Its about time for someone to make it so that ppl can easily load mtl files :)
Great Job!
  • 0

#16 Zelda4evr

Zelda4evr

    GMC Member

  • GMC Member
  • 615 posts
  • Version:Unknown

Posted 11 December 2009 - 01:59 AM

an animated .obj would have a huge file size but it would be possible. youd be the first to do it(i think) :)

its nice to see .mtl support
  • 0

#17 aKtimelli

aKtimelli

    GMC Member

  • New Member
  • 57 posts

Posted 31 March 2010 - 06:48 PM

Whoa... Just awesome! Now i can create models for buildings etc. using my 3D tool and add all the materials, and not worry about the UV maps! Simply great!
  • 0

#18 rushlight

rushlight

    GMC Member

  • GMC Member
  • 20 posts
  • Version:GM8

Posted 08 June 2012 - 04:37 PM

I just got Wavefront (billiard demo), the one thats on the top of this page, and when i run the game from the gmk file, i get an error.

___________________________________________
COMPILATION ERROR in Script: xenon_core_material_load
Error in code at line 112:
if(file_exists(v))ds_map_replace(__map,'map_Kd',background_add(v,0,0,0))
^
at position 72: Wrong number of arguments to function or script.

Any help on this is appreciated, i need this engine to run my game (i'm remaking an old game of mine in 3-D)
Also, i'm running GM 8.0 Full.

<div><br></div><div>{edit}<br>Retried both downloads, still have problem. I have NOT modified the files in anyway what so ever.</div>

Edited by rushlight, 08 June 2012 - 04:40 PM.

  • 0

#19 PsichiX

PsichiX

    GMC Member

  • GMC Member
  • 358 posts

Posted 08 June 2012 - 05:30 PM

unfortunately i do not have GM 8.0, so i can not upgrade code to this version. You need to do this by yourself - just tell me what arguments need ds_map_replace in GM 8.0, then i will explain what should code looks like :)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users