When the alpha tested flag is checked, the bump map's alpha channel can be used as a kind of transparency mask. The shader will either be fully opaque or fully transparent depending on if the alpha value is lighter or darker than 50% gray.
You should use this feature for transparent shaders that need to maintain the appearance of sharp edges regardless of distance and where semi-transparency is not needed. Some examples of this include the 2D "billboard" trees outside Timberland, the floor grates in Derelict, or foliage textures on scenery.
Depending on the texture, you may find that at a distance small transparent or opaque details become lost, such as a chain link fence becoming totally invisible. This is the result of mipmapping in the bump map since the alpha chanel is "blurring" as it becomes smaller and details are being lost. It can be important to tune the bump map's mipmap generation to avoid this:
- Limiting mipmap count results in more aliasing but preserves the impression of fine detail.
- Tuning the alpha bias lightens or darkens the alpha channel in mipmaps to result in more or less pixels passing the 50% alpha test.
Bump maps are special textures that encode the "bumpiness" of the surfaces they map to. They are used to represent fine details like cracks and grooves that affect specular reflections and lighting to make the surface look more geometrically detailed than it actually is.
Artists can create them as simple grayscale height maps in TIFF format, and once compiled by Tool or invader-bitmap into a bitmap tag with "height map" usage, they are represented as standard normal maps for use in-engine. Halo CE does not use height maps and doesn't support tessellation or parallax occlusion. The alpha channel of the bump map is unused unless the shader is alpha tested.
The lighting effect of bump maps can be seen under both dynamic lights and static lightmaps (sometimes called environmental bump maps), with the latter only natively supported in H1A and H1X unless using the CEnshine shader port for H1PC/H1CE. Environmental bump mapping uses incoming light directions which have been precalculated and stored per-vertex during radiosity.
Invalid bump maps
Artists should ensure that the bump map referenced by a shader is a valid normal map. Don't forget to set the bitmap's usage to height map if you're using tool to import a greyscale height map. Also, don't simply reuse a diffuse or a multipurpose map for a bump map. Failure to use a valid normal map will result in the surface appearing extremely dark or black.
Modders who are porting older Custom Edition maps to MCC may find that existing shaders have this problem, since environmental bump mapping was unsupported in H1CE and the original mappers would not have seen this darkening.
By default, environmental bump mapping is rendered by darkening surfaces based on the dot product (angle difference) between incoming light and the bump map. However, in some locations and lighting setups this can result in strange triangular shading artifacts that look like bad smoothing despite level geometry having the intended normals:
- Where small or point-like light sources are very close to surfaces.
- Where sharp shadows should be, but the area has either low geometric complexity and/or uses shaders with low radiosity detail levels.
This could be considered a legacy bug, because the baked lightmap already accounts for diffuse attenuation and it shouldn't be doubly applied. It is made worse by the fact that both the intermediate lightmap mesh and baked lightmap texture have limited resolution so light bleeds into areas it shouldn't, and that per-vertex incident radiosity vectors cannot represent quickly changing light directions across a surface.
Modders who are porting maps from Custom Edition to MCC may also find this useful since the lack of bump mapping in H1CE meant the original mappers never would have seen this issue in their maps and worked around it. Use
debug_camera 1 to help identify the shader if needed.
If you are having this issue and want to change your lighting setup or level geometry to fix it, you can:
- Use high radiosity detail level for affected shaders if you aren't already.
- Tesselate surfaces where sharp shadows lie, especially where shadow umbras and penumbras would lie. This limits light bleeding by forcing the lightmapper to resolve a higher level of detail than it normally would based on quality settings, and results in more incident radiosity vectors being stored to better match the baked lighting texture, but has the cost of increasing triangle count.
- Replace point light sources with large diffuse invisible light casting surfaces that avoid hard shadows. This blurs away sharp shadows but removes artistic choice.
- Avoid putting lights too close to surfaces or in locations that would cast sharp shadows.
Use by gbxmodels
When a gbxmodel references this shader type it will not render correctly in H1CE due to renderer bugs. Specular masking and tinting don't work and sky fog does not render over it. Some affected scenery include the teleporter base and human barricades. It is not recommended to use this shader type for custom objects when targeting Custom Edition, but it is safe to use in H1A.
Structure and fields
|shader environment flags|
|shader environment type|
|lens flare spacing|
Determines how far apart BSP lens flares are generated, in world units, along a surface part using this shader. If set to
References the lens flare to be rendered at the generated lens flare markers. If empty, no lens flares will be generated.
|detail map function|
This controls how the detail map is blended with the base map.
|primary detail map scale|
|primary detail map|
|secondary detail map scale|
|secondary detail map|
|micro detail map function|
|micro detail map scale|
|micro detail map|
|bump map scale|
|bump map scale xy|
|u animation function|
|u animation period|
|u animation scale|
|v animation function|
|v animation period|
|v animation scale|
|self illumination flags|
|primary on color|
|primary off color|
|primary animation function|
|primary animation period|
|primary animation phase|
|secondary on color|
|secondary off color|
|secondary animation function|
|secondary animation period|
|secondary animation phase|
|plasma on color|
|plasma off color|
|plasma animation function|
|plasma animation period|
|plasma animation phase|
|lightmap brightness scale|
|reflection cube map|
Thanks to the following individuals for their research or contributions to this topic:
- Conscars (Notes on bump mapping and alpha testing)
- Kavawuvi (Invader tag definitions)
- MosesOfEgypt (Tag structure research)