Inside Edit Flags (FAQ)

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3284
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Inside Edit Flags (FAQ)

Post by AceMastermind »

[color=#FFBF40]Maveritchell[/color] wrote:If you want to enable transparency, open up your .msh file with a hexeditor and find the name of the texture to which you're going to give transparency (search for .tga), say it's rep_inf_sharpshooter_cape.
Once your cursor is on the name of the .tga, move it back a few places to where it says HBATRB - place your cursor on the place immediately after the last "B."
The next 8 places should be:
  • 04 00 00 00 00 00 00 00
Change that to:
  • 04 00 00 00 04 00 00 00
Then save the msh file and give your actual texture an alpha channel.
I'm going to add more to this for those who like to hex edit.

Common Flags
Transparency and tick box options are found 5th place over from ATRB (Ex. 41 54 52 42 04 00 00 00 00)
  • Hex/Name
    00 - No transparency/no options ticked
    04 - Single sided Transparency
    08 - Double sided Transparency
    10 - Hard Edged Transparency (only) ***See Notes
    14 - Single sided Transparency with Hard Edged Transparency option ticked
    18 - Double sided Transparency with Hard Edged Transparency option ticked ****See Notes
A List of all possible 5th place values can be found HERE, thanks to ANDEWEGET's awesome ZE Material Flags Calculator.
They were previously unknown because they couldn't be produced by the options given in our version of Edit Flags. They're still used in the game but must be hex edited into the material by hand or by using ANDEWEGET's ZE Tools to export from Softimage|XSI.
Pandemic obviously used a more advanced version of Edit Flags at their studio, the BF2_materials.doc shows an image of a different version than was shipped with the modtools.
Their version was likely designed for optimizing assets for Xbox and PS2, and was probably stripped down before releasing the tools which gives a different appearance.



Material Properties
Render Types are found 6th place over from ATRB (Ex. 41 54 52 42 04 00 00 00 00 00)
  • Render Type/Hex/Rendertype name
    0 ----------- 00 - Nothing/normal
    1 ----------- 01 - Glow (unused? -No shader for RenderType?)
    2 ----------- 02 - Lightmap
    3 ----------- 03 - Scrolling *See Notes
    4 ----------- 04 - Specular (See THIS topic by AQT)
    5 ----------- 05 - Gloss Map
    6 ----------- 06 - Chrome (environment map)
    7 ----------- 07 - Animated (See THIS post)
    8 ----------- 08 - Ice
    9 ----------- 09 - Sky
    10 ---------- 0a - Water
    11 ---------- 0b - Detail (will "glow" but probably not meant to) (See THIS post)
    12 ---------- 0c - 2 Scroll (V)
    13 ---------- 0d - Rotate
    14 ---------- 0e - Glow Rotate
    15 ---------- 0f - Planar Reflection
    16 ---------- 10 - Glow Scroll
    17 ---------- 11 - Glow 2 Scroll
    18 ---------- 12 - Curved Reflection
    19 ---------- 13 - NormalMap Fade
    20 ---------- 14 - NormalMap InvFade
    21 ---------- 15 - Ice Reflection
    22 ---------- 16 - Ice Refraction (See THIS post by AQT)
    23 ---------- 17 - Emboss
    24 ---------- 18 - Wireframe (Examples use a bump texture in slot TX1D)
    25 ---------- 19 - Energy **See Notes
    26 ---------- 1a - Afterburner
    27 ---------- 1b - Bumpmap (See THIS post)
    28 ---------- 1c - Bumpmap+Glossmap
    29 ---------- 1d - Bumpmap+Detailmap+Envmap
    30 ---------- 1e - MultiState
    31 ---------- 1f - Shield
  • Render Type above refers to the #s given in the SWBF2 Edit Flags list
    The Render Type name list is based off the SWBF1 "fixed" xsiaddon Edit Flags, not Squipples grid.
    Some Render Types also require a texture input or/in addition to alpha channel in order to work properly.
    Some of the render types might be named incorrectly or are mixed up and some may not even work on PC.



Notes:
  • *Data0 (U or horizontal) -Scroll speed is 7th place over from ATRB (Ex. 41 54 52 42 04 00 00 00 00 00 00)
    *Data1 (V or vertical) -Scroll speed is 8th place over from ATRB (Ex. 41 54 52 42 04 00 00 00 00 00 00 00)
    *You can use this information to adjust your scroll speeds in the msh file rather than having to re-export the msh, to save time.
  • **Data1 -Frequency of the throbbing diffuse texture can be adjusted.
  • ****It appears this is used along with Data0 and Data1 according to fel1_bldg_pitcher_M.msh and seems to be used a lot on foliage or plant props




Here's a translation of the Material DATA chunk to XSI's material property page.
Hidden/Spoiler:
4 bytes = DATA //chunk header
4 bytes = 4... //chunk length always 34 hex = 52 dec (52 bytes)
4 bytes = Illumination tab>Diffuse>Color Red
4 bytes = Illumination tab>Diffuse>Color Green
4 bytes = Illumination tab>Diffuse>Color Blue
4 bytes = Transparency/Reflection tab>Mix Color>Color RGB (no alpha)
4 bytes = Illumination tab>Specular>Color Red
4 bytes = Illumination tab>Specular>Color Green
4 bytes = Illumination tab>Specular>Color Blue
4 bytes = ? //always 00 00 80 3F = 1.0 dec?
4 bytes = Illumination tab>Diffuse>Ambient Red
4 bytes = Illumination tab>Diffuse>Ambient Green
4 bytes = Illumination tab>Diffuse>Ambient Blue
4 bytes = ? //always 00 00 80 3F = 1.0 dec?
4 bytes = Illumination tab>Specular>Specular Decay
5th place after FLGS
Hidden/Spoiler:
00 = Unhidden
01 = Hidden
^These values seem to work only for deformers in the hierarchy.

Source code says:
MSHBlockModel.cpp
[code] if(GetHidden())
flags|=1;
if(GetDynamicallyLit())
flags|=2;
if(GetRetainNormals())
flags|=4;
if(GetRenderAfterShadows())
flags|=8;
if(GetLeaveChildGeometry())
flags|=16;
if(GetPS2Optimize())
flags|=32;
if (flags)
{
StartBlock(file, 'FLGS');
WriteData(file, &flags, sizeof(int));
EndBlock(file);
}[/code]
Hidden/Spoiler:
[list][*]I saw no change in the msh file when the Emissive Color, Cast Shadows, or Receive Shadows options were ticked in BF2 Edit Flags. It's possible that these options can be used as I have my suspicions from looking through shipped msh files but they may have to be edited in manually because our version of the Pandemic Tools might be broken or is skipping them when converting to msh.
[*]If you're curious as to which flags Pandemic used in some assets then you can look in the msh file and see which ones by looking at the 5th or 6th place after ATRB and compare it to my make-shift table above. :P
[*]cis_tread_tank.msh has hex 02 in Material422 fifth place after ATRB
[*]kam_bldg_pod1.msh has hex 01 in Material91 fifth place after ATRB
[*]dea1_bldg_blast_corridor.msh has hex 80 in Material1 fifth place after ATRB
and a hex 88 in Material107_copy_copy2_copy_copy1 fifth place after ATRB
[*]hoth_prop_command_console_c.msh has hex 09 in Material23 fifth place after ATRB
[*]dea1_bldg_froom_spinner.msh has hex 81 in Material2101 fifth place after ATRB
[*]rep_bldg_forwardcenter.msh has hex 05 in Material36 fifth place after ATRB
[*]fel1_bldg_bladder.msh has a hex 84 in Material321 fifth place after ATRB
[*]com_sfx_muzzleflash.msh has a hex 49 in Material31 fifth place after ATRB
[*]imp_inf_darthvader.msh has a hex a0 in Material2 fifth place after ATRB
[*]com_sfx_buff.msh has a hex c8 in Material1 fifth place after ATRB
[*]The 4 places before ATRB such as A, B, C, HB, HC are where the specular decay value is stored for that material, but only the last 2 are being used.
[*]In theory you should be able to use RepSharpshooter's MeshTool4 to insert some Flags that require an input texture and just open the edited msh with a hex editor and change the flag that is used (6th place after HBATRB) and rename helmet_envmap to something else as long as you keep it at least 13 characters in length.
[*]Only Phong and Lambert materials are supported, anything other than these will default to Phong on export. Lambert is the same as Phong but without specular.
[*]Hard edged specifies that each pixel whose alpha channel value is less than 128 (50% opacity) becomes transparent.
[*]Edit Flag shaders are compiled and packed into the retail core.lvl
[*]I found only 25 instances of shaders in the BattlefrontII.exe
[*]CLRL in the msh indicates a Color At Vertices Map property was used
[*]Material16 in hoth_bldg_hangar_entry.msh shows how to use Render Detail (hex 0B) as explained in the misc_documentation.doc. The detail texture is in the first slot (TX1D), and data0 and data1 control the tiling.
[*]Material421 in cis_tread_tank.msh shows how to use Render Bumpmap (hex 1B). The bump texture name is in the first slot (TX1D).
[*]Material321 in fel1_bldg_bladder.msh gives an example of using hex 84 (5th place) and 1B (6th place) in the same material. The bump texture name is in the TX1D slot and the detail texture name is in the TX2D slot.
[*]Material3 in tat_prop_homestead_lamp.msh which is an unfinished asset shows an example of using RenderType 1, a hardpoint also exist for attaching a light.[/list]
http://www.bluevoid.com/opengl/sig00/ad ... node1.html

I'll post more when I find the time...
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

does that mean, you could theoretical hexedit every flag to a model?
User avatar
=BT=What!
Recruit Womprat Killer
Posts: 6
Joined: Fri Aug 15, 2008 12:58 am

Re: Inside Edit Flags (FAQ)

Post by =BT=What! »

Heres the code to make the textures rotate like shields on the ships

After the B put:
04 00 00 00 09 03 00 59
Jaspo
Command Sergeant Major
Command Sergeant Major
Posts: 282
Joined: Sun Mar 01, 2009 4:34 am
Projects :: AotC DoW+++Boonta Eve Classic
Games I'm Playing :: WoT MBWBVC Robocraft
xbox live or psn: No gamertag set
Contact:

Re: Inside Edit Flags (FAQ)

Post by Jaspo »

light bloom glow: 04 00 00 00 02 00 00 00, color & intensity apparently dependent on texture.

flashing, used by door lights on cap ships: 04 00 00 00 00 19 c2 19

and...

Lets see...was the obvious stated yet? Transparency requires an alpha channel on the texture you are using, wherein black is for transparent parts and white is for opaque parts. There. Now the obvious has been stated, in case it wasn't before.
Last edited by Jaspo on Thu Jun 04, 2009 2:41 pm, edited 1 time in total.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

it also works to activate the alphachannel in gimp and delete all color of the parts which have to be transparent
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Inside Edit Flags (FAQ)

Post by AQT »

AceMastermind wrote:Render Types are found 6th place over from ATRB (after "B")
Render Type/Hex/Rendertype name
...
22 ========= 16 = Render Ice Refraction
The above hex value is also found in the stock Bothan Spy model. It gives a player model the "light bending" effect when using the stealth weapon instead of the "ghost" look. Not sure if this is really a discovery but it may be useful for you custom side makers out there. :)
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: Inside Edit Flags (FAQ)

Post by myers73 »

thats interesting, wonder what that would look like for some stock models on an ice map.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

I did some experimenting and this is what i found out(i hope the information is worth the bump):
things i tested:
Render Type......Rendertype name ........Effect...........................Texture1................Texture2...........Texture3
2...................Render Lightmap .........applies detailtexture..........detailtexture**
4...................Render Specular ..........applies gloss****.............../.........................specularmap
5...................Render Gloss Map ........no effect ....................../..........................specularmap
6...................Render Chrome ...........applies envmap................none?!.........................................envmap*
8...................Render Ice .................no effect?!...................../
11..................Render Detail .............applies lightmap ..............lightmap***.............specularmap?
23..................Render Emboss ...........no effect ....................../ .........................specularmap
27..................Render Bumpmap ..........................................bumpmap................specularmap
28..................Render Bumpmap+Gloss ..................................bumpmap*****...........specularmap

*The environment map is a cubemap like the "helmet_envmap" of the tantivetrooper. If no texture is entered the real environment will be reflected.

**Data0 detemines repetition along the x-axis
**Data1 detemines repetion along the y-axis

***The alpha channel will determine the glow strength, the color the glow color. Everything should have atleast 1% opacity, otherwise the texture will appear really dark ingame.

****The alpha channel of the diffuse map determines the gloss strength, for some reason I didnt see an effect when copying over the material info from various units like it was discussed sometime

*****The alpha channel of the bumpmap determines the gloss strength, this is the way to go!

About specular decay and color:
According to the documentation specular color and decay can be modified in xsi.
contrary to this the specular color is not stored in the msh.
The specular decay is stored in the 2 places in front of "ATRB" but it has no effect ingame
Last edited by DarthD.U.C.K. on Thu Mar 17, 2011 12:35 pm, edited 22 times in total.
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3284
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Inside Edit Flags (FAQ)

Post by AceMastermind »

DarthD.U.C.K. wrote:...
according to the documentation specular color and decay can be modified in xsi.
... the specular color is not stored in the msh...
Yes it is:
Hidden/Spoiler:
Image

.........Image.................Image
4 bytes = DATA //chunk header
4 bytes = 4... //chunk length always 34 hex = 52 dec (52 bytes)
4 bytes = Illumination tab>Diffuse>Color Red
4 bytes = Illumination tab>Diffuse>Color Green
4 bytes = Illumination tab>Diffuse>Color Blue
4 bytes = Transparency/Reflection tab>Mix Color>Color RGB (no alpha)
4 bytes = Illumination tab>Specular>Color Red
4 bytes = Illumination tab>Specular>Color Green
4 bytes = Illumination tab>Specular>Color Blue
4 bytes = ? //always 00 00 80 3F
4 bytes = Illumination tab>Diffuse>Ambient Red
4 bytes = Illumination tab>Diffuse>Ambient Green
4 bytes = Illumination tab>Diffuse>Ambient Blue
4 bytes = ? //always 00 00 80 3F
4 bytes = Illumination tab>Specular>Specular Decay


For some clues as to what is what you can look in the xml shaders located in:
C:\BF2_ModTools\data\Common\shaders\PC
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

i guess i didnt search properly then :o , it doesnt seem to have an effect ingame though or am i wrong with that too?

anyway:
I think i understood the scheme behind the values in the 5th place
Here is a complete list of all possible values and their effect:
value 1:
1 : hardedged
2 : nothing?!
3 : hardedged, glow
4 : additive transparency, this also lets you see glow through the object
5 : additive transparency, hardedged
6 : additive transparency emissive color/thin glow around the edges
7 : additive transparency, hardedged emissive color/thin glow around the edges
8 : gloss
9 : hardedged, gloss
A : gloss
B : additive transparency, hardedged, glow, gloss
C : additive transparency, gloss
D : additive transparency, hardedged, gloss
E : additive transparency, gloss
F : additive transparency, hardedged, gloss

value 2:

1 : i didnt see an effect, probably because i had no textures 01 and 0 set. emissive color/thin glow around the edge, at least in combination with 5
2 & 3 : glow, this one is independent as opposed to the normal glow from the angle of the lighting***
4 & 5 : onesided transparency
6 & 7 : onesided, additive transparency, glow
8 : doublesided transparency
9 : doublesided transparency emissive color/thin glow around the edges
A & B : doublesided transparency, hardedged
C : onesided transparency
D : doublesided transparency
E & F : doublesided, additive transparency, glow

***The alpha channel will determine the glow strength, the color the glow color. Everything should have at least 1% opacity, otherwise the texture will appear really dark ingame.

You can combine values 1 and 2 however you want (i havent tested all combinations though)
as you can see most of the effects are cause by two different values, one of them has probably emissive color enabled.
Last edited by DarthD.U.C.K. on Wed Nov 16, 2011 11:06 am, edited 8 times in total.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11079
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Inside Edit Flags (FAQ)

Post by Teancum »

So could this theoretically be used to create a Force Ghost character?
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

yes, i think so. additive transparency should work well for that. giving it gloss would make it probably look even better, well that depends how big the gloss/speculardecay is but since units are pretty small it should work.
C8 should be be good for that. the texture would be blue with bright highlights and the alphachannel would be less trong in these.
Last edited by DarthD.U.C.K. on Sun Nov 28, 2010 5:43 pm, edited 1 time in total.
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3284
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Inside Edit Flags (FAQ)

Post by AceMastermind »

Keep the info coming. :yes:
Now if we just had more people testing and reporting to confirm all this stuff based on their experience with this information and different video settings and/or video cards then one day we could get it all accurately documented before this game becomes so antiquated that no one plays it any longer. :P

I think this information has outgrown this particular thread though and warrants it's own so i'm going to split the relevant posts into a new topic named Inside Edit Flags and folks who find it useful could either bookmark it or find it listed in the FAQ/EYN thread.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

AceMastermind wrote:I think this information has outgrown this particular thread though and warrants it's own so i'm going to split the relevant posts into a new topic named Inside Edit Flags and folks who find it useful could either bookmark it or find it listed in the FAQ/EYN thread.
:P that was what i wanted to suggest, but i didnt because i feared you would say that it neednt be renamed because i found it
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Inside Edit Flags (FAQ)

Post by THEWULFMAN »

Dont now if anyone cares, but im going to test alot of these and have some fun with this 8)
will report back with my findings :yes:
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

a quick force ghost obiwan:
Hidden/Spoiler:
Image
yeah, the hair isnt really good
ive used "58" on the body and "18" on the hair
if you combine the values you cab achieve lot of different effects, 9 and 8 (in the 2nd place) for example have different results in combination with 5 and 7, 8 makes the whole hair glow and 9 only the visible hair. if you use 5 alone, the object wont emiss color?!/glow around the edges, however it will do that if you add 8 or 9 as second value (if i remember right, its easy to get confused when testing a new comination all 2 minutes)
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Inside Edit Flags (FAQ)

Post by THEWULFMAN »

:funny2: I tried ghost Obi-wan too, this is what I got.
Hidden/Spoiler:
Image
That is with the 0b flag. Oh and light bloom was off, because if its on, well...
Hidden/Spoiler:
Image
I also made the texture blue, with some transparency all throughout.
I'm going to play around with the flags and see what I get.
Last edited by THEWULFMAN on Mon Mar 26, 2012 1:08 am, edited 1 time in total.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Inside Edit Flags (FAQ)

Post by DarthD.U.C.K. »

nice :) it looks see you got the same problem with the hair i had first, its more visible than the face when you look from the front. if you use another first value you can probably get rid of the glow and get a nice shine around him.

edit: i think i got a satisfying combination now, using doublesided transparency in the first place was a stupid idea.
Hidden/Spoiler:
Image
the body uses "51" and the hair "54", that makes it less bright and glowy.
Darth_Spiderpig
Sith Master
Sith Master
Posts: 2631
Joined: Fri Mar 27, 2009 10:23 am
Projects :: Something cool...
Games I'm Playing :: BF2 CoDBO BFBC2
xbox live or psn: Has no xbox....Yup
Location: Does whatever a Spiderpig does
Contact:

Re: Inside Edit Flags (FAQ)

Post by Darth_Spiderpig »

That indeed looks nice now, only the skirt seems out of place with that greyish blue color.

Despite of that, nice findings there D.U.C.K. :thumbs:
ForceMaster
Lieutenant General
Lieutenant General
Posts: 737
Joined: Fri Aug 08, 2008 11:27 pm
Projects :: Tron The Grid
Games I'm Playing :: The best..SWBFII
xbox live or psn: No gamertag set
Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe

Re: Inside Edit Flags (FAQ)

Post by ForceMaster »

I need to get the white parts of my texture showing glow ingame, i mean, I have a console with buttons, the texture only have the buttons in white color the rest is grey, black... is posible with some of these values on the 5th place after "B"?
Post Reply