Jump to content


Photo

D3D_Model_Load_Fast For Game Maker Studio


  • Please log in to reply
20 replies to this topic

#1 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 396 posts
  • Version:GM8

Posted 24 June 2013 - 03:07 PM

Game Maker Studio version of d3d_model_load_fast for Game Maker 8.1.141 delivering 1000x faster model loading since July 2012.
 
The extension now overwrites the built-in d3d_model_load and d3d_model_save functions and internally extends the d3d_model_destroy function to deal with the additionally required cleanup, so it is now easier to use than ever - just drop it into your project and get faster 3D model loading and saving.
 
It also supports loading .obj files via the standard d3d_model_load function.
 
Furthermore, the function d3d_model_load_merge(modelindex, file_a, file_b, factor_0_to_1) blends two models, which is useful for frame based animation.
 
There are also commands for modifying existing models at runtime.
 
Download (a sample gmx project (not very cleaned up) + the exported .gex):
 
d3d_model_load_fast.gmx.zip
 
This version was tested with GMS 1.1.964 and 1.1.1044.
 
Have fun, save the planet (faster running programs save energy!).
 
The next step: using a shader to do the interpolation Realtime 3D Animations (Morph-Targets) Example (by DARKLEWA).
 
Regards, 
Paul


Edited by Master Xilo, 23 August 2015 - 02:08 PM.

  • 6

#2 orange451

orange451

    GMC Member

  • GMC Member
  • 1411 posts
  • Version:GM8.1

Posted 24 June 2013 - 05:01 PM

Perfect, thanks so much :)


  • 0

bC14QqN.pngNrTFeil.png


#3 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 2026 posts
  • Version:GM:Studio

Posted 24 June 2013 - 05:47 PM

I assume this one still uses a dll like the other did?

 

Also, it appears that you know how to do the vertex interpolation(since you have that blending function).  Why don't you do it runtime?  I have that going on in my vertex animation extension, but right now, it is pretty fast on desktop but too slow on mobile devices, and I'm waiting for LLVM compilation to help with that.  It would also make things even faster then mine is because you can stick in in the DLL(assuming I'm right in that you are using a DLL to do this).


  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#4 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 396 posts
  • Version:GM8

Posted 25 June 2013 - 12:05 AM

I am indeed doing it in the dll. But it is still faster to create 30 or so static models in memory by interpolation once, then just switch through these, like you do with the images of an animated sprite.


Edited by Master Xilo, 25 June 2013 - 12:06 AM.

  • 0

#5 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 2026 posts
  • Version:GM:Studio

Posted 25 June 2013 - 12:25 AM

I know that one, but then you have to have all of those in memory, so I guess it is a sort of tradeoff.  Right now, I think your way is better, but once LLVM compilation comes, it may shift to my way, especially on mobile devices where there is less video memory.  I'm understanding that GM's d3dModels are stored in video memory in some sort of vertex arrays.  Depending on just how many you have, the advantage could shift either way.

 

Another possible advantage to the way I'm doing it is that I'll eventually (hopefully) have animation transitions working.  You'll be able to go from the middle of a walking animation to the first frame of an idle animation, or from any frame of an idle animation to a movement animation, and it would be smoothly interpolated.  Using the way you do it at the moment, you'd have to create the models for all of those transitions if you were to want them.

 

The main advantage of your way is still sheer speed.  You don't have to interpolate the frames at all at runtime, and it can still be smooth, depending on how many frames you have.


  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#6 Venomous

Venomous

    GMC Member

  • GMC Member
  • 1626 posts
  • Version:GM:Studio

Posted 25 June 2013 - 12:47 AM

Great! I was hoping you'd make this extension compatible with Studio. This will probably come in handy somewhere.


  • 0

#7 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 396 posts
  • Version:GM8

Posted 28 June 2013 - 07:55 PM

With vertex shaders and custom vertex attributes upcoming, we can do this with shaders in realtime. Then we will have both speed and low memory footprint.


  • 0

#8 powergannon123

powergannon123

    GMC Member

  • GMC Member
  • 342 posts

Posted 24 July 2013 - 11:40 PM

The models are invisible when I use them in this extension. Even in the included example.


  • 0

#9 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 350 posts
  • Version:GM:Studio

Posted 25 July 2013 - 01:00 AM

Another possible advantage to the way I'm doing it is that I'll eventually (hopefully) have animation transitions working.  You'll be able to go from the middle of a walking animation to the first frame of an idle animation, or from any frame of an idle animation to a movement animation, and it would be smoothly interpolated.  Using the way you do it at the moment, you'd have to create the models for all of those transitions if you were to want them.

 

The main advantage of your way is still sheer speed.  You don't have to interpolate the frames at all at runtime, and it can still be smooth, depending on how many frames you have.

Actually you can interpolate between animations. (I'm already doing it with the gex version for gm 8.1)

The only thing you need to do, is to save the last frame of the old animation in a 3D model if the transition begins.

Then you calculate your "normal" interpolation from the new animation (like running) and save it in a second model.

 

After that is done, you can use a 3rd model which is an interpolation between the last frame of the old animation and the new animation. It works very well.

 

Also good to see that this amazing gex also works on studio. With the new shader capabilities, it opens up new possibilities for 3D games and effects in general.


Edited by -LEWA-, 25 July 2013 - 01:05 AM.

  • 0

signature.png


#10 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 2026 posts
  • Version:GM:Studio

Posted 25 July 2013 - 03:47 PM


Actually you can interpolate between animations. (I'm already doing it with the gex version for gm 8.1)

The only thing you need to do, is to save the last frame of the old animation in a 3D model if the transition begins.

Then you calculate your "normal" interpolation from the new animation (like running) and save it in a second model.

 

After that is done, you can use a 3rd model which is an interpolation between the last frame of the old animation and the new animation. It works very well.

 

Also good to see that this amazing gex also works on studio. With the new shader capabilities, it opens up new possibilities for 3D games and effects in general.

 

 

I'm not clear on whether you are talking about doing the interpolation beforehand, or during the game's runtime.If you mean beforehand, then yes you can, but it is simply another model/frame of animation you have to export and import, taking up space, and you can't do it say, from the half point of an animation instead of the last frame, unless you also make those frames, which mean more space.  The way I'm talking about you don't have to do anything except the normal frames, and then at run-time it would calculate it for you, but then, since it is truly dynamic geometry there is no point in putting it into GM's static models, and so it would be slower, though it would save much space by comparison.

 

If you are talking about doing the calculation at run-time, then basically, we are talking about the same thing, except that in my opinion there is no point in putting it into a GM static model, rather then just drawing it outright.  I also saw a recent post by Mike Dailly agreeing with this, though I don't remember where off the top of my head.

 

Also, yes, I agree with combining this extension with the new shaders.  One thing I'm waiting to see is if they let you save custom vertex calls(for shaders) to models, or if it will only work with immediate mode drawing(which is when you draw without GM's models, rather vertex by vertex via function calls).


  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#11 programmmer5

programmmer5

    GMC Member

  • GMC Member
  • 395 posts
  • Version:GM:Studio

Posted 03 October 2013 - 09:46 PM

hey i would love to use this, but it doesn't seem to work. . . i am just getting a blank screen (well a sort of a dark-ish grey screen) and then nothing. i don't know if its something on my end, an update with game maker studio has caused this not to work, the example or this is just out of date.
i really want to use this , i am so fed up with the lag of loading an animation frame after frame (i end up loading about 50 frames for a run cycle just so it looks at least a bit smooth)
  • 0

Kidnapped Treasure [Jam 13]

xulg.png

WIP: Space Chase (3D)GMC jam 9 

Space Chase 3D for Android < Click it!

 


#12 Brawl

Brawl

    Magnitude Games

  • GMC Member
  • 1299 posts
  • Version:GM:Studio

Posted 03 October 2013 - 11:25 PM

The GMC does not allow adfly and other money making links without an optional mirror to a direct download. You need to add another link.

This seems like an interesting and useful DLL. Does it do anything for the speed of creating models in game, or is that still the same?
  • 0

#13 MishMash

MishMash

    GMC Member

  • GMC Member
  • 1124 posts
  • Version:GM:Studio

Posted 17 December 2013 - 12:21 AM

Hi, I Really loved this extension in GM8.1 however i just cannot get this version to work with studio, I'm unsure as to exactly why. I am trying to achieve model interpolation, worked great in GM8.1 however the equivilant code i used:

Create:

model = d3d_model_create();
d3d_model_copy(model, obj_player_load.internalFrame[frame2]);
 
Step:
<code to determine frames and ratio>
d3d_model_merge(model,obj_player_load.internalFrame[cFrame],obj_player_load.internalFrame[nFrame],f);

I Have a feeling this is to do with the fact that it is an extension rather than an outright dll, not sure though. (Yes i have included the extension), I also had to disable my antivirus as it kept on flagging d3dmlf.dll as dangerous.

Anyway i would love if you could help me out, or fix something if it needed to be fixed. ( I Would be willing to donate towards this extensions development if needed. )
Thanks!

Edit: accidentally noticed there was a function called init, however calling this made no difference D:! I Do think that the issue is to do with the clash of d3d_model_load, i think it was fine before when it was named d3d_model_load_fast(..)


Edited by MishMash, 17 December 2013 - 12:25 AM.

  • 0

VitalitySig18thMar.png


#14 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 396 posts
  • Version:GM8

Posted 19 March 2014 - 07:42 PM

Fixed links. Dropbox public file hotlinking really isn't meant for sharing with many people.
  • 0

#15 Cyril

Cyril

    GMC Member

  • GMC Member
  • 123 posts

Posted 14 May 2014 - 09:13 AM

V1.3.1336

 

"Fatal error in d3d_model_load_fast, could't find function table"


  • 0

#16 GamerXP

GamerXP

    GMC Member?

  • GMC Member
  • 443 posts
  • Version:GM:Studio

Posted 14 May 2014 - 11:57 AM

Great. That's almost the thing I needed. If you're going to fix it for 1.3 - could you also upload sources? I need some way to generate models from the DLL, and it looks like it's just right thing for me to use.


  • 0

#17 Roblomal

Roblomal

    GMC Member

  • GMC Member
  • 12 posts
  • Version:GM8.1

Posted 11 June 2014 - 09:27 AM

Whenever I use d3d_model_load2 or d3d_model_load_fast GM:Studio throws a stack overflow, the example does the same!


  • 0

#18 -LEWA-

-LEWA-

    GMC Member

  • GMC Member
  • 350 posts
  • Version:GM:Studio

Posted 11 June 2014 - 09:47 AM

Well, Studio evolves over time and changes a lot of things internally.

That in turn causes the gex to break. (As it doesn't get updated with the new GM studio versions.)

 

As far as i can remember, the gex didn't worked after the 1.2 update of GM: Studio.


Edited by -LEWA-, 11 June 2014 - 09:49 AM.

  • 0

signature.png


#19 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 396 posts
  • Version:GM8

Posted 11 June 2014 - 11:24 AM

I see the demand for this is still high, despite per-vertex animation now being possible via shaders.

I guess because loading and saving models is still very slow in GMS.

I already started work on updating it a few weeks ago but couldn't find the source for some seemingly random problems with memory accesses (I guess the script interpreter also had some changes). 

I can't promise anything. Maybe I can upload the sources of what I have, but I really did not change much yet at all.

 

Btw. the current download already includes the source code in the '/Extension' folder.


  • 0

#20 Roblomal

Roblomal

    GMC Member

  • GMC Member
  • 12 posts
  • Version:GM8.1

Posted 11 June 2014 - 11:30 AM

I see the demand for this is still high, despite per-vertex animation now being possible via shaders.

I guess because loading and saving models is still very slow in GMS.

I already started work on updating it a few weeks ago but couldn't find the source for some seemingly random problems with memory accesses (I guess the script interpreter also had some changes). 

I can't promise anything. Maybe I can upload the sources of what I have, but I really did not change much yet at all.

 

Btw. the current download already includes the source code in the '/Extension' folder.

Yesterday I tried editing the source, but could you send / link me to all the included files needed? I couldn't find much, I also develop in CodeBlocks, so I still try to link it to the Windows SDK files.

Oh and btw, I appreciate it how quick you guys respond on the GMC.. :)

 

 

PS: If there is no possibility, I'll just not port my decompiled project (yes, I lost it, a friend still got a Rar i sent him previous summer vacation) to GM:Studio.. It is just the loading time that matters, aswell the 3D rendering speed.. GMS it's flexibility is getting worse day by day.


Edited by Roblomal, 11 June 2014 - 12:35 PM.

  • 0

#21 Mornedil

Mornedil

    GMC Member

  • GMC Member
  • 1450 posts
  • Version:GM:Studio

Posted 06 October 2014 - 02:53 PM

Have there been any progress in updating this for the newer versions of Studio :)?

Even though it's possible to do per-vertex animation via shaders, this would still be useful as it is using a different technique.

For example, as GamerXP mentioned, it would be very useful to be able to generate models from this DLL, and from what I understand that is not possible when blending the models with a shader.


  • 0

~ Pause systems for your games ~


EasyPauseIcon.png                   icon_medium.png