Materials Overview


The following section discusses the materials system used in Halo.  The materials or shaders are used to define the properties of the surfaces for which they are applied to as well as the rendering properties for the surface.  This section includes material naming conventions and rules, special material names, and special shader symbols or flags.


Overview


Materials define the properties of a surface in Halo.  These properties not only include the basic texture image to render on the surface, but includes any special rendering effects as well as other data such as the type of material it is in regards to physics and projectile impact particle effects.  Materials are often referred to as shaders.

As with most data in Halo, shaders are defined in a data file called a tag.  The shader tag contains many properties, flags, and fields for linking to other data tags, such as image data tags known as .bitmap tags.  The .bitmap tag contains image data, such as an image and its associated mips, as well as other settings.  The most basic shader typically contains just some simple default settings and a reference to a .bitmap for its base map.

There are many different shader types denoted by their file extension.  The file extensions are fairly self explanatory, but there are 3 shader types that are commonly used for the creation of level geometry, these are listed and explained in the table below.


.shader_environment Basic shader applied to the surfaces of a level environment.  This shader is used for opaque surfaces.  This is the most common type of shader used or applied to surfaces in environments. 

This shader contains the basic properties, such as radiosity properties, physics properties, environment shader properties, environment shader type, lens flare, diffuse properties (includes base map, primary and secondary detail maps for texture or material blending, and micro detail map properties), bump properties, texture scrolling animation, self illumination properties, specular properties, and reflection properties (includes cube map properties).
.shader_transparent_chicago Shader applied to surfaces of a level environment that are to have transparent elements. This shader can be used when only 1 or 2 maps are required to construct or define the shader.  Maps refer to a .bitmap tag reference.

This shader contains properties such as radiosity properties, physics properties, chicago shader properties, lens flare, map information (includes the maps to use to create the shader, the color functions, alpha functions, and the map u-scale and v-scale), 2D texture animation, as well as additional flags to define the shader properties.
.shader_transparent_chicago_extended A more complicated version of the .shader_transparent_chicago.  This shader is used in place of the .shader_transparent_chicago when the shader requires 3 or 4 maps to define it.  Maps refer to a .bitmap tag reference.

In addition to the properties listed for the .shader_transparent_chicago, this shader has two sections that are used to define a 4 Stage Maps for video hardware that supports this kind of rendering and 2 Stage Maps section that is used to define the shader on video hardware that cannot handle 3 or 4 maps in a shader definition.


Material Naming Conventions and Rules


The following are some VERY important rules concerning materials used in Halo.

Materials have specific names and are applied to the surfaces (polygons, faces, etc...) of objects.  It is these material names that reference a shader (in the form of a shader data tag).  The shader is then used by Halo to apply the appropriate properties to the surface for that shader, including the rendering effects that should be applied as defined in the shader tag file.

The material name on the surface corresponds to the name of the shader tag.  For example, a material is applied to the surface of a wall (the wall is made up of 2 polygons and the material is applied to these polygons).  The name of the material as it appears in 3ds Max is "metal_wall".  A shader will exist for this material, in this case the associated shader data tag would be named "metal_wall.shader_environment".

The shader data tags referenced for levels exist in subdirectories under the main level directories for that particular level.  The subdirectory is called "shaders" (similarly, .bitmap files used by the shader files are contained in a directory called "bitmaps" ).  These shader data tags contained in these shader directories are accessible to any level.  Levels can reference their own shaders, shaders from other levels, the shaders can reference .bitmaps from other levels, etc...

When the .map cache file is created that contains the level assets, the associated resources (such as the shader data tags) are pulled into the .map cache file.  Because of how the .map cache file is created and how the tools work the following rules must be followed:

1) Every material name (shader name) MUST BE UNIQUE.  For example, you cannot have two or more shader files named "grass.shader_enviroment" that are used in a level(s) that are placed in multiple level's "shader" directories. 

It is common practice that if custom shaders (new shader or a variation of an existing shader) are need for a specific level, the shader name is prefixed by the name of the level.

Using the example above, if you have a level called "mylevel" and wanted a new shader or to make changes to a shader that already existed called "grass.shader_environment" then you would call the shader "mylevel_grass.shader_environment" and place it in the "shader" sub-directory under the level directory, in this case the "mylevel" game level directory.

2) Material names (shader names) must be 32 characters or less (excluding the file extension name).


Special Materials


The following table shows the list of special material names in Halo.  These material names are hard-coded in the tools and game to be recognized as having specific or unique functionality.

These texture names should NOT be used or applied unless it is for the specific function for which they are designed.  No data tags (.bitmap, .shader_environment, etc...) should use the name of a Special Material.


+sky Applied to surfaces to render the skybox or sky model.
+seamsealer Applied to temporary surfaces or geometry to "seal" the level.  Most commonly used to seal holes or other open edged areas of the level during construction and testing.  For multiplayer levels, +seamsealer should never be applied to a face in the final build of the level.
 
+portal Applied to faces that are used to define general portals used in the visibility solution or rendering occlusion for the level.
+exactportal Applied to faces that are used to define an exact volume or portal.&left; Such faces typically cover exactly the opening of a doorway, passage, or hallway to define a very distinct volume that can be used to occlude the rendering of other areas of the level.
 
+weatherpoly Applied to faces that are used to define a portal or portals to use as a volume for setting weather effects.
+sound Applied to faces that are used to define volumes for sound.
 
+unused Reserved special material that has many uses and can be used in conjunction with the special shader symbols to define its use and behavior. 

For example, it can be used with the "$" Fog Plane Shader Symbol to make +unused$, which can be applied to faces to construct a fog plane that is used to define a volumetric fog region.


Shader Symbols


The following table shows the list of special material or shader symbols used to assign certain attributes or behaviors to a particular surface in the level.

These shader symbols are hard-coded in the tools and game to be recognized as applying their associated attribute when added to the end of a material name.

These shader symbols should NOT be used or added to the name of a material unless it is for the specific function for which it is designed.  These symbols should not appear anywhere in the normal name for a material nor should these special symbols appear in the name of a data tag (.bitmap, .shader_environment, etc...). 

The shader symbols are taken into account during the compilation of the .jms and affect the surfaces at this time. 

For example, if a ladder is created using 2 polygons and has the material "ladder" (without the quotes) assigned to it.  This ladder is able to be viewed from both sides. To make the ladder a true ladder with respect to the Halo engine AND to make it able to be viewed or rendered from both sides the "%" would be added as well as the "^".  The resulting material name viewed in 3ds Max for the Sub-Material under the Multi/Sub-Object would be "ladder%^" (without the quotes).  The data tag name would still be ladder.shader_environment.


% Two sided property.  This flag or shader symbol when applied to a material that is applied to a face or surface renders both sides of the surface instead of just the side that the normal is facing.
# Transparent property.  This flag or shader symbol when applied to a material that is applied to a face or surface allows the surface up to be rendered with transparency.
! Render only property.  This flag or shader symbol when applied to a material that is applied to a face or surface makes the surface only render the face, the face or surface will not have any collision.
* Large collideable property.  This flag or shader symbol when applied to a material that is applied to a face or surface sets the surface up to not be rendered and only have collision.
$ Fog plane property.  This flag or shader symbol when applied to a material that is applied to a face or surface makes the surface not be rendered.  The faces acts as a fog plane that can be used to define a volumetric fog region.
^ Ladder property.  This flag or shader symbol when applied to a material that is applied to a face or surface sets the surface up to act as a ladder for the player.  The surfaces is climbable.
- Breakable property.  This flag or shader symbol when applied to a material that is applied to a face or surface allows the surface to be able to be destroyed or broken.  (e.g. glass)
& AI deafening property.  This property does not apply to multiplayer levels.   This flag or shader symbol when applied to a material that is applied to a face or surface allows that surface to inhibit AI functions.
@ Collision only property.  This flag or shader symbol when applied to a material that is applied to a face or surface sets the surface up to not be rendered and only have collision.
. Exact Portal property.  This flag or shader symbol when applied to a material that is applied to a face or surface makes the surface able to be used to define an exact portal.