I'm going to add more to this for those who like to hex edit.Maveritchell 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:Change that to:
- 04 00 00 00 00 00 00 00
Then save the msh file and give your actual texture an alpha channel.
- 04 00 00 00 04 00 00 00
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
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.
- ***The use of hard-edged transparency will eliminate the "transparency interference" you get when two objects with transparency are viewed one in front of the other.
Thanks to Maveritchell for this information.
- ****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:
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
00 = Unhidden
01 = Hidden
^These values seem to work only for deformers in the hierarchy.
Source code says:
MSHBlockModel.cpp
Code: Select all
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);
}- 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.

- 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.
I'll post more when I find the time...








