3d model code vs d3d speed

James222

Member
Hey guys so I wanna ask a question about 3d again, what is more efficient for game maker, especially for reasonably complex models to load the model as a .d3d file or to create it in code for example:

model[2] = d3d_model_create();
d3d_model_primitive_begin(model[2], pr_trianglestrip);
d3d_model_vertex(model[2], 100, 100, 0);
d3d_model_vertex(model[2], 100, 200, 0);
d3d_model_vertex(model[2], 150, 150, 200);
d3d_model_vertex(model[2], 100, 200, 0);
d3d_model_vertex(model[2], 200, 200, 0);
d3d_model_vertex(model[2], 150, 150, 200);
d3d_model_vertex(model[2], 200, 200, 0);
d3d_model_vertex(model[2], 100, 100, 0);
d3d_model_vertex(model[2], 150, 150, 200);
d3d_model_vertex(model[2], 100, 100, 0);
d3d_model_vertex(model[2], 100, 200, 0);
d3d_model_vertex(model[2], 200, 200, 0);
d3d_model_primitive_end(model[2]);


^ the models im using have arround 1000 lines of d3d_model_vertex

each room has a few (far more complex then above) model files, I am also using game maker 8.1 for reasons.... well the only reason is im trying to challenge myself and send gm 8.1 out with a bang you could say.
 

Roa

Member
anything native is always faster, but uhh, you shouldn't see a noticable difference really, even at a few thousand pollies. Just make sure you're not constantly reloading it. Load it once at game or room start and call on it when needed. Not reloading it for every instance or something. Model loading has never been an issue for me. I've loaded half a million polies and even dynamically created models to the count with no major hitching.
 

Roa

Member
Or you could user buffers and have 5,000,000 triangles before you notice a framerate hit.
I'm going to hijack a question in here real quick. is it true you can only make one vertex buffer submission? Like, I swore mike said you can only store and send one vertex buffer at a time. Whats your experience on that?
 

Mike

nobody important
GMC Elder
Quickest way is to have a 3D model per-generated in a binary file, then load that in using buffer_load(). You can then convert that directly into a vertex_buffer with the single call vertex_create_buffer_from_buffer()

d3d_models
are horrible...
 
F

Fodderbot

Guest
Consider your art pipeline as well. you could get an artist to make models with a simple modeling program and export it to d3d, but you'll never get one to describe one in code. Not to mention the manhour expenditure to hard code them. Sounds like a complete nightmare for anything more than really basic primitives and hyper-lowpoly shapes. I think that was the reason for 3d modeling programs in the first place.
 
F

Fodderbot

Guest
There was a post by user FredFredrickson that I ran across:
I actually made an Addon for Blender that will help with this sort of thing - you might find it useful: http://martincrownover.com/blender-addon-gm3d/

Basically, you can load up/edit your model in Blender, then export directly from Blender to a GML script of the model, or a GameMaker format model.

Hopefully this isn't considered blogspam, because it's not meant to be. Blender is a really great piece of software, and I made this to help reduce my reliance on tools that had either a short shelf life or were just unsupported.

The files it outputs are quite large, but it works, and the models load nice and fast.
That would be worth checking out.

its in a thread called "
D3D File format information
"
 
Top