shader_environment

🚧 This article is a stub. You can help expand it by submitting content in pull requests or issues in this wiki's source repo.

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.

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
pad(44)
diffuse flags bitfield(16)
Flag Mask Comments
rescale detail maps 0x1
rescale bump map 0x2
pad(2)
pad(24)
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
secondary detail map scale f32
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
material color
ColorRGB
  • red: f32
  • green: f32
  • blue: f32
pad(12)
bump map scale f32
  • Default value: 1.
bump map scale xy
Point2D (little endian?)
  • x: f32
  • y: f32
  • 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)
  • Default value: 1.
u animation scale f32 (base map repeats)
  • Default value: 1.
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)
  • Default value: 1.
v animation scale f32 (base map repeats)
  • Default value: 1.
pad(24)
self illumination flags bitfield(16)
Flag Mask Comments
unfiltered 0x1
pad(2)
pad(24)
primary on color
ColorRGB
  • red: f32
  • green: f32
  • blue: f32
primary off color
ColorRGB
  • 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)
  • Default value: 1.
primary animation phase f32 (seconds)
pad(24)
secondary on color
ColorRGB
  • red: f32
  • green: f32
  • blue: f32
secondary off color
ColorRGB
  • 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)
  • Default value: 1.
secondary animation phase f32 (seconds)
pad(24)
plasma on color
ColorRGB
  • red: f32
  • green: f32
  • blue: f32
plasma off color
ColorRGB
  • 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)
  • Default value: 1.
plasma animation phase f32 (seconds)
pad(24)
map scale f32
  • Default value: 1.
pad(24)
specular flags bitfield(16)
Flag Mask Comments
overbright 0x1
extra shiny 0x2
lightmap is specular 0x4
pad(2)
pad(16)
brightness Fraction: f32
  • Maximum: 1
pad(20)
perpendicular color
ColorRGB
  • red: f32
  • green: f32
  • blue: f32
parallel color
ColorRGB
  • 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
  • Maximum: 1
pad(28)
perpendicular brightness Fraction: f32
  • Maximum: 1
parallel brightness Fraction: f32
  • Maximum: 1
pad(16)
pad(8)
pad(16)
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)