Material System (Engineering)

Materials define the properties of a surface. 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 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.

Shader Tag
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 the Shader Environnement, the Shader Transparent Chicago and the Shader Transparent Chicago Extended.

Shader Environnement
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 :
 * Radiosity properties
 * Physics properties
 * Lens flare
 * Diffuse properties (base map, primary and secondary detail map and micro-detail map)
 * Bump properties
 * Texture scrolling animation
 * Self-illumination properties
 * Specular properties
 * Reflection properties (include cube map)

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 :
 * Radiosity properties
 * Physics properties
 * Lens flare
 * Map information (color functions, alpha functions, and the u-scale and v-scale)
 * 2D texture animation
 * Additional flags...

Shader Transparent Chicago Extended
A more advanced 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.

Shader Transparent Glass
Coming...

Shader Transparent Generic
Coming...

Shader Transparent Plasma
Coming...

Shader Transparent Water
Coming...

Shader Transparent Meter
Coming...

Material Naming Conventions and Rules
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.
 * 2) Material names (shader names) must be 32 characters or less (excluding the file extension name).

Special Materials
There is special materials hard-coded in the engine and the tools 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 Material
Applied to surfaces to render the skybox or sky model. Its name is +sky.

Seam Sealer Material
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. Its name is +seamsealer.

Portal Material
Applied to faces that are used to define general portals used in the visibility solution or rendering occlusion for the level. Its name is +portal.

Exact Portal Material
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. Its name is +exactportal.

Weather Polygon Material
Applied to faces that are used to define a portal or portals to use as a volume for setting weather effects. Its name is +weatherpoly.

Sound Material
Applied to faces that are used to define volumes for sound. Its name is +sound.

Unused Material
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. Its name is +unused.

Shader Symbols
There is another special shaders 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 Shader
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. Its symbol is %

Transparency Shader
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. Its symbol is #

Render Only Property Shader
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. Its symbol is !

Large Collideabilty Shader
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. Its symbol is !

Fog Plane Property Shader
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. Its symbol is $

Ladder Property Shader
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. Its symbol is ^

Breakability Shader
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). Its symbol is -

AI Deafening Shader
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. Its symbol is &

Collision Only Property Shader
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. Its symbol is @

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. Its symbol is .