Jump to content
Sign in to follow this  
feersum.endjinn

How to fix/merge sections in parts from old models

Recommended Posts

Norsu told me to post here as apparently some other people have also had problem with their models ending up with waaaay too many sections despite faces sharing same material and texture. This apparently happens often when parts from old OFP MLODs are copied into new O2.

And as everyone hopefully already knows, too many sections = baaad for performance.

This is our starting situation. Note number of sections in status bar on top of O2. This is waaaay too much for such middle LOD and as such, ingame performance more than halves when there are full squads worth of soldiers with RK95 onscreen compared to if they were equipped with BIS' M4's.

http://www.somuchforsubtlety.net/arma/sectionfixing1.jpg

Now, to fix that we first select all faces that are supposed to be in same section and hit "E" key to get to face properties dialog. Note that "User value" field is empty instead of having number there, it means faces in selection have different values in there, which causes them to be split into separate sections. We type there "0" and hit Apply.

sectionfixing2.jpg

We do same thing for textures and material fields in they contain "..." and make sure that Lighting & Z-bias also have identical values.

http://www.somuchforsubtlety.net/arma/sectionfixing3.jpg

Now we can see that amount of sections has dropped to 3, but model still contains 1 section for muzzle flash and 2 sections for weapon. It is a lot better, but we want to still get it down to just 2, muzzle flash and weapon.

Next step is going to "Face" menu and selecting "Sort"

http://www.somuchforsubtlety.net/arma/sectionfixing4.jpg

Often after this operation number of sections displayed doesn't want to update right away, so we go into another LOD and then come back to editing same LOD. After this small detour however finally our model is where we want it to be - one section for muzzle flash and one for whole weapon LOD and now ArmA engine can render whole weapon using single Direct3D call which makes modern GPUs very happy.

http://www.somuchforsubtlety.net/arma/sectionfixing5.jpg

<span style='color:red'>4 hotlinked pictures over 100kb removed.</span>

Share this post


Link to post
Share on other sites

Note that this doesn't apply only to old OFP models. If you import something from MLOD ArmA models you need to check sections carefully then too. Also when using mass texture renaming tool sections can get screwed.

Share this post


Link to post
Share on other sites

nice tute ! notworthy.gif

btw can someone explain what is section and what for it used by the game ?

i also wonder if this kind ofoptimization is done automatically after binarization ?

Share this post


Link to post
Share on other sites

Cheers feersum.endjinn smile_o.gif

Share this post


Link to post
Share on other sites

oh damnit.. just when i was done with my weapon wink_o.gif

Thank you, my HK G3 now only got 2 sections.

Ok, so anyone have guidelines whats ok for weapons (2), plane (?), tank(?), apc(?)... less is more i understand but still, anyone?

Share this post


Link to post
Share on other sites

SHWEET! i'll get to this immediately!

EDIT - Just curious, does this mean that each different texture has a different section, in a perfect world? smile_o.gif If so, apologies for the stupid question.

Share this post


Link to post
Share on other sites

thumbs-up.gif Thanks for the tutorial. I always wondered how do clean up the sections....Like above said, in frensh models you normally don't have to clean up, but sometimes it can help when you had to fix small stuff (st errors) and other stupid things you overlooked...

It already helped me with one of my models where i knew it had to be lower by default.

Again, big thanks.

->Mod, can this be sticked please. This is very imported info (kicks wiki).

OFFTOPIC: If time allows, i or someone should make a tutorial about ST errors, Non-planar faces and Non-linear mapping errors.

Share this post


Link to post
Share on other sites
EDIT - Just curious, does this mean that each different texture has a different section, in a perfect world? smile_o.gif If so, apologies for the stupid question.

Yes and no wink_o.gif. If you have texture that uses two rvmats then it's two sections. Identical texture + rvmat pairs should be in the same section.

You can enable sections toolbar in Oxygen from Windows->Resource Library.

Share this post


Link to post
Share on other sites

feersum.endjinn

Yesterday I asked you in a friendly PM to edit the 4 way too big images, you read the PM and obviously decided to ignore my direction.

+1 WL for the 4 pics and ignoring me is more then just fair I think.

Share this post


Link to post
Share on other sites

A hint: if ypou've done all the above but still cannot get the sections to merge do the following:

- select the faces in sections you want to merge

- Faces>Move Bottom (oor Move Top, Bottom is however best if you have other sections that use semi-transparent textures)

- wait a couple of seconds for sections window to refresh.

Then if you have semi-transparent textured sections like muzzle flash that now occlude other faces (if you only used the move bottom on nontransparent faces it must be allright allready) - mark them and use Faces>Move Top.

Share this post


Link to post
Share on other sites

Very useful info feersum and very appreciated. I wrote a very basic O2 script that sets the User value to 0 for every face in the needed. Probably not the finest solution but should save you some work.

SAVE YOUR MODEL BEFORE USING THE SCRIPT!

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#include "std\SpecialLod.hpp"

console=openStandardIO;

_p3d = this;

_levels = getResolutions this;

_LODs = getObjects this;

_objects = [];

for "_i" from 0 to (count _levels - 1) do

{

_x = _levels@_i;

if(IS_LOD_RESOLUTION(_x) || _x == LOD_VIEW_GUNNER || _x == LOD_VIEW_PILOT || _x == LOD_VIEW_CARGO)then

{

_objects = _objects + [_LODs@_i];

};

};

for "_i" from 0 to (count _objects - 1) do

{

_object = _objects@_i;

for "_j" from 0 to (countFaces _object - 1) do

{

_face = (_object face _j);

_val = _face setFaceFlags [[25,31],0];

};

};

Share this post


Link to post
Share on other sites
@ Jan. 31 2008,13:30)]A hint: if ypou've done all the above but still cannot get the sections to merge do the following:

- select the faces in sections you want to merge

- Faces>Move Bottom (oor Move Top, Bottom is however best if you have other sections that use semi-transparent textures)

- wait a couple of seconds for sections window to refresh.

Thanks Panda[PL]. That got rid of one extra section smile_o.gif.

Share this post


Link to post
Share on other sites

Great tut fearsum and thanks for the extra Panda

Interestingly the Piper had 86 sections to start with in the 1.0 res lod

It has 13 textures (yes I know, not ideal)

Checked all textures and they already had 0 in User

So I went through every texture (Ctrl click texture name) and did the Move bottom (and move top for glass/transparents)

With that the count finally dropped (you really have to wait and change LOD to see it)

Final count down to 22

I'm guessing I won't be able to reduce it any further (without maybe texture merging)

Share this post


Link to post
Share on other sites
Guest RKSL-Rock

I'd like to add my thanks too. Guys you have seriously just saved me hours of work.

Thank you very much.

Share this post


Link to post
Share on other sites

yo guys any way to fix this problem in the models made with O2 for ArmA? not importing them from OFP... I tried everything, nothin happened.. sad_o.gif

Share this post


Link to post
Share on other sites
yo guys any way to fix this problem in the models made with O2 for ArmA? not importing them from OFP... I tried everything, nothin happened.. sad_o.gif

Huh?? Would you like to expain that again.

Share this post


Link to post
Share on other sites
Quote[/b] ]Huh?? Would you like to expain that again.

I suppose he made new models, so no imports from OFP.

Well we could help, if only you provide some more info and best some screenshots of what is not working.

Info: like how many textures and materials.

Share this post


Link to post
Share on other sites
yo guys any way to fix this problem in the models made with O2 for ArmA? not importing them from OFP... I tried everything, nothin happened.. sad_o.gif

Linker,first make sure each textured polygon has an rvmat assignment or o2 might assume each or some are a unique section.

not solved,then make sure any model parts are not mistakenly textured with a different sections attributes,for example a few small "gear texture" polys are unnoticably textured with a "uniform texture" by mistake,this will cause problems as the polys belong to different parents.

Share this post


Link to post
Share on other sites

I'm interested. Is there a way to "trade off" performance between sections and texture number?

For example, if a model is made with say, 7 sections, 3 of which are very small textures (say, 128x128 max), or no texture at all, is it faster to have the three sections or have one section with 3 teensy textures within it?

Share this post


Link to post
Share on other sites
I'm interested. Is there a way to "trade off" performance between sections and texture number?

For example, if a model is made with say, 7 sections, 3 of which are very small textures (say, 128x128 max), or no texture at all, is it faster to have the three sections or have one section with 3 teensy textures within it?

Less sections is always faster. You should merge your small textures into one bigger texture, and smallest LOD should never have more than 1 section (with some special textures like muzzle flashes being exception, as most of time they are not rendered).

Technical reason for this is that one section can be rendered using single Direct3D call so there are less usermode<->driver context switches and more work can be offloaded to hardware instead of doing it on CPU.

See this graph (batch is same thing as section in this case) for performance comparisons.

What this chart means is that if your LOD consists of 1500 faces that are in single section, it would render about 5x faster than having 5 sections that are 300 faces each. And these numbers are for old hardware like Radeon 9800, for newer GPUs differences are even greater.

patsitvx3.th.png

Share this post


Link to post
Share on other sites

Quick question about sections.

In some of my lods, I have a section called "not mapped" that is associated with the zesleh proxy does this count as a section or is it ignored?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×