Environment shaders are intended for opaque and alpha-tested surfaces in BSPs. A key feature of this shader is its ability to blend between two detail maps, making it ideal for outdoor ground shaders. It also supports cubemaps, normal maps, and masked specularity which can be used for metallic surfaces like Forerunner structures.
When the "is alpha tested" flag is checked, the normal map's alpha channel can be used to mask the material. In this case, the material is either fully opaque or fully transparent depending on the alpha value. The billboard trees outside Timberland make use of this feature.
Use by gbxmodels
When a gbxmodel references this shader type it will not render correctly in Custom Edition due to renderer bugs. 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.
Structure and fields
This tag inherits fields from shader which are not shown here. See the parent's page for more information. The following information is unique to the shader_environment tag.
Field |
Type |
Comments |
shader environment flags |
bitfield(16) |
|
Flag | Mask | Comments | alpha tested | 0x1 | | bump map is specular mask | 0x2 | | true atmospheric fog | 0x4 | | |
shader environment type |
enum |
|
Option | Value | Comments | normal | 0x0 | | blended | 0x1 | | blended base specular | 0x2 | | |
lens flare spacing |
f32 |
|
lens flare |
Reference? : lens_flare
|
|
|
pad(44) |
|
diffuse flags |
bitfield(16) |
|
Flag | Mask | Comments | rescale detail maps | 0x1 | | rescale bump map | 0x2 | | |
|
pad(2) |
|
|
pad(24) |
|
base map |
Reference? : bitmap
|
|
|
pad(24) |
|
detail map function |
enum |
|
Option | Value | Comments | double biased multiply | 0x0 | | multiply | 0x1 | | double biased add | 0x2 | | |
|
pad(2) |
|
primary detail map scale |
f32 |
|
primary detail map |
Reference? : bitmap
|
|
secondary detail map scale |
f32 |
|
secondary detail map |
Reference? : bitmap
|
|
|
pad(24) |
|
micro detail map function |
enum |
|
Option | Value | Comments | double biased multiply | 0x0 | | multiply | 0x1 | | double biased add | 0x2 | | |
|
pad(2) |
|
micro detail map scale |
f32 |
|
micro detail map |
Reference? : bitmap
|
|
material color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
|
pad(12) |
|
bump map scale |
f32 |
|
bump map |
Reference? : bitmap
|
|
bump map scale xy |
Point2D (little endian?) (2) |
- Only set when the tag is compiled into a map cache.
|
|
pad(16) |
|
u animation function |
enum |
|
Option | Value | Comments | one | 0x0 | | zero | 0x1 | | cosine | 0x2 | | cosine variable period | 0x3 | | diagonal wave | 0x4 | | diagonal wave variable period | 0x5 | | slide | 0x6 | | slide variable period | 0x7 | | noise | 0x8 | | jitter | 0x9 | | wander | 0xa | | spark | 0xb | | |
|
pad(2) |
|
u animation period |
f32 (seconds) |
|
u animation scale |
f32 (base map repeats) |
|
v animation function |
enum |
|
Option | Value | Comments | one | 0x0 | | zero | 0x1 | | cosine | 0x2 | | cosine variable period | 0x3 | | diagonal wave | 0x4 | | diagonal wave variable period | 0x5 | | slide | 0x6 | | slide variable period | 0x7 | | noise | 0x8 | | jitter | 0x9 | | wander | 0xa | | spark | 0xb | | |
|
pad(2) |
|
v animation period |
f32 (seconds) |
|
v animation scale |
f32 (base map repeats) |
|
|
pad(24) |
|
self illumination flags |
bitfield(16) |
|
Flag | Mask | Comments | unfiltered | 0x1 | | |
|
pad(2) |
|
|
pad(24) |
|
primary on color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
primary off color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
primary animation function |
enum |
|
Option | Value | Comments | one | 0x0 | | zero | 0x1 | | cosine | 0x2 | | cosine variable period | 0x3 | | diagonal wave | 0x4 | | diagonal wave variable period | 0x5 | | slide | 0x6 | | slide variable period | 0x7 | | noise | 0x8 | | jitter | 0x9 | | wander | 0xa | | spark | 0xb | | |
|
pad(2) |
|
primary animation period |
f32 (seconds) |
|
primary animation phase |
f32 (seconds) |
|
|
pad(24) |
|
secondary on color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
secondary off color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
secondary animation function |
enum |
|
Option | Value | Comments | one | 0x0 | | zero | 0x1 | | cosine | 0x2 | | cosine variable period | 0x3 | | diagonal wave | 0x4 | | diagonal wave variable period | 0x5 | | slide | 0x6 | | slide variable period | 0x7 | | noise | 0x8 | | jitter | 0x9 | | wander | 0xa | | spark | 0xb | | |
|
pad(2) |
|
secondary animation period |
f32 (seconds) |
|
secondary animation phase |
f32 (seconds) |
|
|
pad(24) |
|
plasma on color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
plasma off color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
plasma animation function |
enum |
|
Option | Value | Comments | one | 0x0 | | zero | 0x1 | | cosine | 0x2 | | cosine variable period | 0x3 | | diagonal wave | 0x4 | | diagonal wave variable period | 0x5 | | slide | 0x6 | | slide variable period | 0x7 | | noise | 0x8 | | jitter | 0x9 | | wander | 0xa | | spark | 0xb | | |
|
pad(2) |
|
plasma animation period |
f32 (seconds) |
|
plasma animation phase |
f32 (seconds) |
|
|
pad(24) |
|
map scale |
f32 |
|
map |
Reference? : bitmap
|
|
|
pad(24) |
|
specular flags |
bitfield(16) |
|
Flag | Mask | Comments | overbright | 0x1 | | | 0x2 | | lightmap is specular | 0x4 | | |
|
pad(2) |
|
|
pad(16) |
|
brightness |
Fraction: f32 |
|
|
pad(20) |
|
perpendicular color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
parallel color |
ColorRGB (3) - red:
f32 - green:
f32 - blue:
f32 |
|
|
pad(16) |
|
reflection flags |
bitfield(16) |
|
Flag | Mask | Comments | dynamic mirror | 0x1 | | |
reflection type |
enum |
|
Option | Value | Comments | bumped cube map | 0x0 | | flat cube map | 0x1 | | bumped radiosity | 0x2 | | |
lightmap brightness scale |
Fraction: f32 |
|
|
pad(28) |
|
perpendicular brightness |
Fraction: f32 |
|
parallel brightness |
Fraction: f32 |
|
|
pad(16) |
|
|
pad(8) |
|
|
pad(16) |
|
reflection cube map |
Reference? : bitmap
|
|
|
pad(16) |
|
This information was partially generated using Invader tag definitions.
Acknowledgements
Thanks to the following individuals for their research or contributions to this topic:
- Kavawuvi (Invader tag definitions)
- MosesOfEgypt (Tag structure research)