Board index FlightGear Development

Model optimisation

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Model optimisation

Postby helijah » Thu Jan 12, 2012 8:02 pm

Moderator: following up discussion on viewtopic.php?f=14&t=14719

JC_SV :

I summarizes for everyone lol

1 - Always use the same material for all the objects (eg DefaultWhite for example) except for transparent objects (use a transparent material in this case:) ). Then 2 and 2 only material in Blender (or other) : DefaultWhite and Transparent

2 - All objects must have a texture. This is the best method for color

3 - Never mix textures opaque and transparent textures in the same file. Then opaque texture in 24bit (without alpha channel) and transparent textures with alpha channel (in 32 bit).

Regards Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: A-26-Invader Cockpit Improved

Postby AndersG » Thu Jan 12, 2012 9:56 pm

helijah wrote in Thu Jan 12, 2012 8:02 pm:1 - Always use the same material for all the objects (eg DefaultWhite for example) except for transparent objects (use a transparent material in this case:) ). Then 2 and 2 only material in Blender (or other) : DefaultWhite and Transparent


This is not good advice if you desire realistic material properties. A color texture only provides the diffuse(/ambient) color of the object while the standard shading model also has specular color and shininess as parameters (which define how the specular highlights look). These are not the same for all materials (opaque or translucent).

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2524
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: A-26-Invader Cockpit Improved

Postby xiii » Thu Jan 12, 2012 10:20 pm

And I can add one trick: for objects that use simply a transparent material (which is much better than using a transparent texture), put them at the end of the .ac file.

How to do that ? Open the .ac file in AC3D (free for one month if you don't want to pay a license) hit F8 to open the tree window, right click on the objects name in that list, choose "Move to tail" in the contextual menu. Done, save. Having all the transparent objects in a group moved to the list tail is even more convenient when you have a lot of objects with a transparent material.

Alexis
If the engines are Pratt and Whitney, the seats best be Martin Baker
xiii
 
Posts: 472
Joined: Tue Jan 08, 2008 11:04 pm

Re: A-26-Invader Cockpit Improved

Postby helijah » Thu Jan 12, 2012 10:21 pm

AndersG wrote in Thu Jan 12, 2012 9:56 pm:
helijah wrote in Thu Jan 12, 2012 8:02 pm:1 - Always use the same material for all the objects (eg DefaultWhite for example) except for transparent objects (use a transparent material in this case:) ). Then 2 and 2 only material in Blender (or other) : DefaultWhite and Transparent


This is not good advice if you desire realistic material properties. A color texture only provides the diffuse(/ambient) color of the object while the standard shading model also has specular color and shininess as parameters (which define how the specular highlights look). These are not the same for all materials (opaque or translucent).

/Anders


Of course, but in this case it is best to set these parameters in the XML file associated with the ac. Modeling software are all different and trust these software is a rookie mistake !

Now it's only a matter of experience. It is always possible to do otherwise. Everyone does as he pleases. After all, my experience in modeling is light, right ?

Regards. Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: A-26-Invader Cockpit Improved

Postby helijah » Thu Jan 12, 2012 10:23 pm

xiii wrote in Thu Jan 12, 2012 10:20 pm:And I can add one trick: for objects that use simply a transparent material (which is much better than using a transparent texture), put them at the end of the .ac file.

How to do that ? Open the .ac file in AC3D (free for one month if you don't want to pay a license) hit F8 to open the tree window, right click on the objects name in that list, choose "Move to tail" in the contextual menu. Done, save. Having all the transparent objects in a group moved to the list tail is even more convenient when you have a lot of objects with a transparent material.

Alexis


As before, this can be done in the xml file. What is much more flexible and much more simple for modify for beginners !

Regards. Emmanuel
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: A-26-Invader Cockpit Improved

Postby HHS » Thu Jan 12, 2012 10:55 pm

Helijah, You are not quite right!

We have to differ here between Objects; Meshes and Materials.
An Object is made of one or more mesh. A mesh is a grid of many vertices which shapes the Object. And material defines how each group of vertices may appear in color, specular and transparency. You can have multiple materials in one mesh.

As I understood todays GPU's they don't care much about meshes, and vertice numbers, but object numbers. So you should keep this small.

Even if using the materials animation to set the parameters in .xml, you need to split the aircraft into several objects, so you can apply different materials to it via .xml.
And splitting an object into several ones needs more perfomance, not really noticeable on on modern systems, but on older systems.

Edit: so better have indeed multimaterials in one mesh instead of many objects with just one material.

"Within your modeling tool, try work with large meshes instead of groups of small meshes - but please don't mistake this as a request for grouping multiple, distinct buildings into a single AC3D file. I know that this can result in a very unpleasant workflow; we are working on optimizations in FlightGear that will combine mesh parts automatically."


from: http://wiki.flightgear.org/Howto:_Improve_framerates which includes the small guide from where I quoted, written by Tim Moore, one of FlightGear's graphis and OSG-specialists.

And to my knowledge the transparency ordering isn't needed with OSG any more. It was when we used plib, but that's long, long time ago.

Btw. why some of your aircraft are having window glasses which flashes together with the lights? (Aircrane, DR400...)

At the end it is apperance and details vs. perfomance.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: A-26-Invader Cockpit Improved

Postby helijah » Thu Jan 12, 2012 11:04 pm

HHS wrote in Thu Jan 12, 2012 10:55 pm:Helijah, You are not quite right!


Since you will always disagree with me, simply because it's me. I do not understand your response.

Do what you want. Personally I do not care. But avoid me now.

Ah ! And of course, learns to read:
- Reduce the number of different textures used on a model to a minimum. It's better to use a few (or one!) big textures than many little ones.
- Avoid mixing textured and untextured geometry in the same model. Build the coloring into the texture map instead.
- Textures containing alpha cause various problems. In order to be rendered correctly, translucent geometry must be sorted by distance on the CPU. Furthermore, geometry is sorted on a course level (basically by mesh), so you may see various artifacts. If you have some transparent parts of a model, you should violate the first rule above and assign those parts to their own texture.
- Don't assign an RGBA texture to a model that is completely opaque!


No difference with my post !

and
- Within your modeling tool, try work with large meshes instead of groups of small meshes - but please don't mistake this as a request for grouping multiple, distinct buildings into a single AC3D file. I know that this can result in a very unpleasant workflow; we are working on optimizations in FlightGear that will combine mesh parts automatically.


This concerns the mesh, and has no relation to the question of JC_SV and my answer .

farewell
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: A-26-Invader Cockpit Improved

Postby gooneybird » Fri Jan 13, 2012 11:40 am

Hmm, interesting

HHS wrote in Thu Jan 12, 2012 10:55 pm:As I understood todays GPU's they don't care much about meshes, and vertice numbers, but object numbers. So you should keep this small.


Does this mean a medium poly AI model with fewer objects would be better than a low poly model with many objects :?:
My Github repository (mostly AI stuff) https://github.com/gooneybird47
User avatar
gooneybird
 
Posts: 3046
Joined: Sat May 31, 2008 2:57 pm

Re: A-26-Invader Cockpit Improved

Postby HHS » Fri Jan 13, 2012 1:26 pm

Oh helijah- :roll: - Please stop using Google Translate.


As I said "not quite right" - quite means in french: "entier" or "exact".
So that did never meant that I thought that all your statements had been wrong.

I refered to this:

helijah wrote:Of course, but in this case it is best to set these parameters in the XML file associated with the ac
...

As before, this can be done in the xml file. What is much more flexible and much more simple for modify for beginners !


Because this can only be done per .xml if the model is splitted in several objects. Each single material = a single object. So many materials = many objects.
That's something GPU's will more slow down than many vertices, as I understood Mathias Fröhlich (?) and some sources on the net.
Last edited by HHS on Fri Jan 13, 2012 1:28 pm, edited 1 time in total.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: A-26-Invader Cockpit Improved

Postby HHS » Fri Jan 13, 2012 1:28 pm

gooneybird wrote in Fri Jan 13, 2012 11:40 am:Does this mean a medium poly AI model with fewer objects would be better than a low poly model with many objects :?:


Can't tell for AI. Maybe the bottleneck is just the the .xml like on the scenery.

I just do know that for MP the file should be small, as the loading will produce lags.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: A-26-Invader Cockpit Improved

Postby i4dnf » Fri Jan 13, 2012 2:03 pm

The biggest part of the lags is due to runtime mipmap creation (scaled versions of the textures), which is a very slow and CPU intensive operation. This can be cured with precomputed mipmaps, but currently the only method of storing these is the .dds file format, and that is a controversial subject at the moment.
i4dnf
Retired
 
Posts: 743
Joined: Wed Sep 09, 2009 8:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: A-26-Invader Cockpit Improved

Postby helijah » Fri Jan 13, 2012 4:09 pm

HHS wrote in Fri Jan 13, 2012 1:26 pm:That's something GPU's will more slow down than many vertices, as I understood Mathias Fröhlich (?) and some sources on the net.


Obviously you work fluent in 3D. Do you know of any algorithm of Gouraud or Phong and you have nothing to learn. You are able to do 3D without using OpenGL (or other library). Your skills are complete and your infinite experience .... It's true! You read on the net !

Here is a short text I wrote 2 years ago.
http://helijah.free.fr/digression.html

And my little work in 3D. Before and after the arrival of OpenGL
http://helijah.free.fr/pages/ebmodel.htm

But, of course, your experience is much greater because you have read on the net!
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: A-26-Invader Cockpit Improved

Postby HHS » Fri Jan 13, 2012 5:59 pm

Welcome to 2012, helijah!

3d-graphics and the technics, the algorithm etc. behind is not a secret anymore.

And you don't to be a professional programmer anymore to create good 3d-models for games. It can be helpfull, but it is not needed anymore.

I don't claim for me that all things which I said or quoted are correct and applies to FlightGear.
So I'm not sure about my statement according multimaterials on a single mesh - but a lot of what I said I also learned by Tim Moore and Mathias Fröhlich, who actually had a bigger influence on graphics in FGFS, and do understand more of the inside of FGFS than many others.

I'm aware of being wrong, but in contrary to you my self-esteem is not damaged when some younger people, but maybe with equal or more talent, comes up here. I don't see them as rivals, but as addition and somebody I can learn from. I accept their knowledge, undepending of their source they used for: self-learning via Internet; study at University; learning by doing; experiments... I respect them -something you should learn, when you still want to work together with younger peoples.

Btw. my very first experience with as 3d-program was actually POVRay for win32, back in the mid-90's.
So I came probably in touch with EB Model 3 as well, but can't remember it well. There had been some more Model-programs for POVRay in this time.

Btw2: I already asked the mods to split the parts about optimal 3d-modeling for FGFS.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: A-26-Invader Cockpit Improved

Postby helijah » Sat Jan 14, 2012 5:08 am

When people (young or not) are competent, I learn of them, no worries. But your reactions worthy of a children of 5 year do not add anything here. Proof While you waste time trying to denigrate me, JC_SV corrects his problem with my response.

It is so easy to criticize ... Continue. I do not care. It amuses me the evening between two models
Some planes (and other) for FlightGear
http://helijah.free.fr
and
http://embaranger.free.fr
User avatar
helijah
 
Posts: 1339
Joined: Wed Dec 27, 2006 1:35 pm
Location: Chartres (France)
Callsign: helijah
IRC name: helijah
Version: GIT
OS: GNU/Linux

Re: A-26-Invader Cockpit Improved

Postby HHS » Sat Jan 14, 2012 1:03 pm

helijah wrote in Sat Jan 14, 2012 5:08 am:It is so easy to criticize ... Continue. I do not care. It amuses me the evening between two models


But as we all can see here it is not easy for you to accept criticism. This provocation:
helija wrote:"But your reactions worthy of a children of 5 year do not add anything here"
wasn't needed.

But well... We all here are already used to it....
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 7 guests