3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1] 2

Author Topic: optimizing your 3d model  (Read 3941 times)

« on: October 18, 2010, 07:55:41 PM »
some time ago I was modeling a race track and bumped into a little problem, suddenly a guardrails model hunted my framerate very badly. it wasnt a highpoly model and it's texture wasnt big either, in fact... I could put a BIG tree with 10 times the amount of polys and framerate was better.
solution apparantly wasnt found and the thing really drove me nuts.

http://www.3drad.com/forum/index.php?topic=2702.0

now, I faced the same problem with some scenery model.
only this time I found the root of the problem.

I saw that not only 3drad had problems displaying my model, but framerate was affected in mview too, so obviusly the problem was the model. but what?!
suddenly I figured it out, even being just one model (or to put it better, just one .x file), it was a model compose by several different objects that I selected and exported as a whole using 3dsmax.

so, I opened 3dsmax, and using the attach option in the edit mesh modifier, merged all the objects into a single mesh.
and bingo!, framerate raised from the dead.

TIP: make sure your model is composed by a single object (in the modeling program, not a single skinmesh object in 3drad), no matter how many different objects you used to make your things in the modeling program.

looking at the thread I link at the begining of this one, I believe people was trying to tell me this all the time but I just didnt catch it.

now:
is there a better (automatic or performace wiser) method to solve this that attach every mesh in the modeling program?
I tried mview now but if I open the .x file that I saved a lot of different objects all together in the modeling program, I can only select each object one by one, how can I merge them all?
any other thoughts on this?
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #1 on: October 19, 2010, 12:05:00 AM »
I didn't know this and this is very interesting, I have some wierd cases myself I need to checkout now.
Thanks loop for the heads up.
« Reply #2 on: October 19, 2010, 05:43:00 AM »
As a rule of thumb you should always export objects that are ultimately going to be considered "One" object, merged. Usually what happens is that allot of "extra" stuff is deleted from history that is usually not seen when you perform the merge. Youl also notice a big difference in Framerate if for instance you have a model with different textures on it.  ;)
Roll out!
http://www.youtube.com/watch?v=VD8MvMaPNO4

Do you have kids between the ages of 3 and 9?

http://www.amazon.com/dp/B007K1EFC6
« Reply #3 on: October 19, 2010, 05:51:42 AM »
Youl also notice a big difference in Framerate if for instance you have a model with different textures on it.  ;)

well, THAT one didnt knew it.
meaning that just 1 texture = better frame rate, I assume... that's actually pretty inconvenient because then I should uvwrap the hell out of a lot of things that were easily done with plane, box and even cilindrical uv simple maps. good to know, thought.
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!

psikotropico

« Reply #4 on: October 19, 2010, 06:14:01 AM »
hey loop, strange issue... (like the reference to your older post, now I remember... :P) I never had framerate slowdown importing meshes from 3dsMax... surely you're doing something wrong... anyway, it's difficult to analyze without seeing your model in deep...

- are you using MultiSubObject materials? that helps a lot in game engines...
- I assume you're making a group with all objects and then 'Export selected'... it isn't?

now:
is there a better (automatic or performace wiser) method to solve this that attach every mesh in the modeling program?
I tried mview now but if I open the .x file that I saved a lot of different objects all together in the modeling program, I can only select each object one by one, how can I merge them all?
any other thoughts on this?

do you mean if there is a quick way to merge all objects in the scene? yes, sure... just besides the attach button there is a very small button that opens the object list window... then, select all objects and voil�... you have all visible objects attached...

there is no apparent difference between mesh or poly, but I like work with polys because they have more options... even you can export objects with modifiers (simmetry, displace, etc...) without needing to convert to poly or mesh before exporting...

hope it helps
« Reply #5 on: October 19, 2010, 06:31:23 AM »
psikoT,

tried it now making a group and framerate was about 10% of what I get if I merge them all, btw the merge list little button really makes pretty easier the merging work, thanks!

no, Im not using multiSubObject materials, have to look into that.

what I did was: create single objects with their textures (like... parts of a whole) and then merge them all, and when I merge objects with different textures there pops a dialog "Attach options" with 3 options, where I select "Match Material IDs to Material", not because I know what Im doing but because the mesh looks ok after pressing the OK button  :P
I know I know, not pro, at all.
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #6 on: October 19, 2010, 06:52:30 AM »
@Loop
I use Max for all my modelling, and as I'm working with some heavy meshes at the moment......so I thought I'd try out your hypothesis.

Refer to attached pics:

My original model in Max has 260 submeshes and was exported as .x file in three different ways:
SkinmeshA: exported from Max as set of "grouped" submeshes (the usual way in which I export)
SkinmeshB: exported from Max as 260 seperate submeshes all selected. (under discussion in this topic)
SkinmeshC: exported from Max as one mesh composed of 260 "attached" submeshes (under discussion in this topic)

As can be seen, there is not too much of a difference in framerate (the "attached" submeshes coming off the worst)

AKA: The 3D Raddict http://www.3draddict.com/
« Reply #7 on: October 19, 2010, 07:28:06 AM »
AllanF, thanks for taking your time to check this out.

I have to say the results are not what I would expect...

so I did a quick test, a lot of boxes with a texture (each box have a UVW Mapping modifier, with the box mapping option selected, which is -with variations in the mapping options- what I been using for the textures in my objects), and exported 3 times: group, seperate and all attached.

didnt test it in 3drad, but in mview, as the variation in framerate results were shared before and mview automatically display the framerate and dosnt care how I named the meshes.

the results were pretty much the same as exposed in my  ... hypothesis.

Im attaching a zip with all the used files in case someone want to look into.

-----------------------
I'd like to add that another important reason because I rather to test these meshes into mview is that mview display a bigger range of framerate, for example... the attached composed mesh gave me over 550 fps, while the seperate one just around 60. yet, while both are over 60 fps which is kinda the maximum you'll see in a practical way, there's a HUGE difference.

another thing is that I saw some ...mmm strange behaves in 3drad.
for example, with my scenery model "bad" mesh, I was stuck at 30 fps, no matter if I delete all the other meshes or dissabled shadows, which I have to say is weird. so I wouldnt consider it very reliable to check this kind of things.

althought, this small differences that you may only view with big ranges of framerate (mview) could affect a more overloaded final product in a noticeable way.
« Last Edit: October 19, 2010, 07:47:48 AM by loop »
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #8 on: October 19, 2010, 10:16:32 AM »
Very strange indeed!

I confirm your findings using your example together with mview: 950fps for attached meshes, 200fps for others.
Using my example meshes with mview, not much difference between them, averaging out at 43fps.

I really have no explanation in your case........maybe its because in the unattached meshes ALL the surfaces are processed, and in the attached meshes just the exposed outer surfaces are processed.....I don't know  ???


AKA: The 3D Raddict http://www.3draddict.com/
« Reply #9 on: October 19, 2010, 10:31:22 AM »
I'd guess 3drad/3Impact uses one drawcall and a seperate shader pass for each submesh, both would be expensive to the rendering loop.

I found a discussion over at the ogre forums, but I don't know if it applies the same way here.
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=52380&start=0#p355272

Mic

« Reply #10 on: October 19, 2010, 11:06:24 AM »
One thing to also note is that every texture on an object is treated as it's own draw call, or as its own mesh. So if you can separate objects by texture, that could also help performance.
« Reply #11 on: October 19, 2010, 11:25:35 AM »
so,
one drawcall per submesh + one drawcall per texture?
that would raise overhead to the power of a freaking lot depending on how your model is made.

btw, nice post that one at ogre forums, shadmar.
2 things I noted are:

Quote
Ogre renders and culls submeshes completely separately. This means that splitting or combining can have an immense effect on performance, depending on the situation.
this is pointed wrong next, but anyway raise a question: "how it works in 3drad/3Impact?"
3drad cull per submesh or all together?, render per submesh or all together?

also, someone says over there
Quote
It depends on the exporter, when exporting.
so, there's a chance that my case is strange because how Im exporting?
AllanF, you got different results with your meshes, could you export my .max model and see if you get the same .x files with the same results that I got?

Fernando,
could you drop some light on how 3drad/3impact work out this things so becomes clear what are the best ways to make the meshes in any case ??  ???
I mean.. considering culling and render, where the differences would be noticed if we have a little object that is show completly or not show at all, or something that is spread all over a big terrain.. and only parts are show at times, like could be a big vegetation model.
« Last Edit: October 19, 2010, 11:33:21 AM by loop »
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #12 on: October 19, 2010, 11:54:26 AM »
Loop, your file does not load in my Max.
You must have a higher Max version then me.......I use Max 8.

Glad you raised this topic.......depending on Fernando's reply, I might be able to reorganize my meshes to sqeeze out some extra framerate.
AKA: The 3D Raddict http://www.3draddict.com/

Mic

« Reply #13 on: October 19, 2010, 12:13:24 PM »
I will have to follow up with this later, because I have many test files sitting on my HD. I will get back to you guys soon.

psikotropico

« Reply #14 on: October 19, 2010, 12:33:51 PM »
same results as AllanF... also, if I re-export your model, I got a 941 Kb .x file (don't know why your models are only about 500 Kb), but framerate is about 800 fps...

edit: ok, you are exporting as binary compressed... right? I think that doesn't matter... anyway, those are my export settings for static meshes and the re-exported model in mview:
« Last Edit: October 19, 2010, 12:44:31 PM by psikoT »
Pages: [1] 2