This article's documentation is for the "GoldSrc" engine. Click here for more information.
Quake1-16px.png

BSP flags (Quake and GoldSrc): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{{goldsrc topicon}}{{quake topicon}} {{tabs|BSP flags|quake and goldsrc=1|quake2=1|source=1}} {{draft}} {{note|These aren't actually flags, except for the surface flags; the p...")
 
m (Setting bug notice hidetested=1 param on page where the bug might not need tested in param specified)
 
(33 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{goldsrc topicon}}{{quake topicon}}
{{goldsrc topicon}}{{quake topicon}}
{{tabs|BSP flags|quake and goldsrc=1|quake2=1|source=1}}
{{tabsBar|main=BSP flags}}
{{draft}}
{{todo|Better page name; these aren't actually flags, except for the surface flags.}}
{{note|These aren't actually flags, except for the surface flags; the page title is for consistency so that the tabs work.}}
== Surface flags ==
Despite having a 32-bit integer available to be used, most flags go unused. Vanilla Quake engines and GoldSrc only use TEX_SPECIAL.
{| class="wikitable"
|-
! Bit !! Flag name !! Dev comment !! Notes
|-
| 0x00000001 || TEX_SPECIAL || sky or slime, no lightmap or 256 subdivision || Surface does not have a lightmap.
Used by {{quake}} [[QBSP]] to tell [[LIGHT (Quake compiler)|LIGHT]] to not generate lightmaps for sky and liquid surfaces, which are not subdivided to account for maximum lightmap size (15x15 luxels, or 240x240 texels). [[ericw-tools]] additionally uses this on surfaces textured with {{code|TRIGGER}}.
 
{{goldsrc}} [[QCSG]] and [[HLCSG]] set this flag on sky surfaces and surfaces textured with {{code|AAATRIGGER}}.
{{bug|hidetested=1|[[QCSG]] and [[HLCSG]] still use {{code|<nowiki>*</nowiki>}} to declare liquids as not lightmapped, even though they are prefixed with {{code|!}} instead. Therefore, [[QRAD]] and [[HLRAD]] will always lightmap all liquid surfaces, unless they are flagged in some other manner, such as using {{newbspguy|4.1}}.}}
|-
| 0x00000002 || TEX_MISSING || johnfitz -- this texinfo does not have a texture || Used by fitzquake and derivatives to indicate a missing texture
|-
| 0x00000800 || ??? || N/A || Used by VERTEXNORMALS [[BSPX]] lump to indicate a face that should have smooth shading based upon its vertex normals.
|-
| 0x00004000 || TEX_SHOULDHIDE || this flag is temporary; it might be set after CSG, but will be dropped after BSP || Used by [[VHLT]]; set if {{code|zhlt_hidden}} is set. Tells HLBSP to not add the face to any visleaves, and will result in HLRAD not reflecting light off of the face.
 
Texture names with the suffix {{code|_HIDDEN}} will yield the same result, without using this surface flag.
|-
|}


== Contents types ==
== Contents types ==
Contents are stored as a signed 32-bit integer, and are always negative.  
Contents are stored as a signed 32-bit integer, and are always negative.
Entities are always CONTENTS_SOLID; in {{goldsrc|2}}, the {{code|skin}} KV to override the contents of any brush entity that inherits [[CBaseAnimating (GoldSrc)|CBaseAnimating]], but the entity collision type must also be set accordingly.
{{clarify|Contents are stored in visleaves somehow, not directly in clipnodes. This is probably related to why they're always negative.}}
{| class="wikitable"
|-
! Value !! Internal name !! Dev comment !! Notes
|-
| -1 || CONTENTS_EMPTY ||  || Non-solid, and doesn't affect VIS.
|-
| -2 || CONTENTS_SOLID ||  || Default.
|-
| -3 || CONTENTS_WATER ||  || A liquid, usually water. Textures with the {{code|!}} prefix are usually water when part of worldspawn, unless they are slime, lava, or a current.
|-
| -4 || CONTENTS_SLIME ||  || Like water, deals damage to the player and some monsters when touched.
|-
| -5 || CONTENTS_LAVA ||  || Like slime, but deals double the damage.
|-
| -6 || CONTENTS_SKY ||  ||
|-
| -7 || CONTENTS_ORIGIN || removed at csg time || Replaces an entity's {{code|origin}} KV, then is removed by CSG (does not exist in compiled BSP).
In GoldSrc, if a brush has this contents at runtime, it will be treated like water (and is referred to in FGDs as "volumetric light").
|-
| -8 || CONTENTS_CLIP || changed to contents_solid ||
|-
| -9 || CONTENTS_CURRENT_0 ||
| rowspan=6 | Acts like water combined with a {{ent|trigger_push (GoldSrc)|alt=trigger_push}} with a speed of 2048 in the given direction.<br>
In Quake, this is treated as regular water, being commented out with an {{code|<nowiki>#ifdef QUAKE2</nowiki>}}.
|-
| -10 || CONTENTS_CURRENT_90 || 
|-
| -11 || CONTENTS_CURRENT_180 ||
|-
| -12 || CONTENTS_CURRENT_270 || 
|-
| -13 || CONTENTS_CURRENT_UP || 
|-
| -14 || CONTENTS_CURRENT_DOWN ||
|-
| -15 || CONTENTS_TRANSLUCENT {{quake|not}} ||  || Like water, but never solid. Despite this, it still affects VIS.
|-
| -16 || CONTENTS_LADDER {{quake|not}} ||  || Climbable. Usually set via the game code for the func_ladder entity.
|-
| -17 || CONTENTS_FLYFIELD {{quake|not}} ||  || Zero gravity
|-
| -18 || CONTENTS_GRAVITY_FLYFIELD {{quake|not}} ||  ||
|-
| -19 || CONTENTS_FOG {{quake|not}} ||  ||
|-
|}


== Ambient Types ==
== Ambient Types ==
Ambients are stored as an unsigned byte, and are capped to a maximum of four types on an engine level. Only Quake uses them, and it only uses AMBIENT_SKY and AMBIENT_WATER, which are hardcoded in the engine to play specific sounds when a visleaf containing  
Ambients are stored as an array of 4 unsigned bytes, indicating volume. Only Quake uses them, and it only uses AMBIENT_SKY and AMBIENT_WATER, which are hardcoded in the engine to play specific sounds when a visleaf containing the given ambient type is in the current PVS.
 
{{confirm|Probably only affected by world brushes, so probably not cast by func_water.}}


{| class="wikitable"
{| class="wikitable"
|-
|-
! Header text !! Header text !! Header text
! Index !! Name !! Notes
|-
|-
| 0 || AMBIENT_WATER ||  
| 0 || AMBIENT_WATER || Normally cast by any liquid ({{code|<nowiki>*</nowiki>}} prefix in {{quake}}; {{code|!}} prefix in {{goldsrc}}), unless they are slime or lava.
|-
|-
| 1 || AMBIENT_SKY ||  
| 1 || AMBIENT_SKY || Normally cast by sky brushes ({{code|sky}} prefix)
|-
|-
| 2 || AMBIENT_SLIME ||  
| 2 || AMBIENT_SLIME || Normally cast by slime brushes ({{code|<nowiki>*slime</nowiki>}} prefix in {{quake}}; {{code|!slime}} prefix in {{goldsrc}})
|-
|-
| 3 || AMBIENT_LAVA ||  
| 3 || AMBIENT_LAVA || Normally cast by lava brushes ({{code|<nowiki>*lava</nowiki>}} prefix in {{quake}}; {{code|!lava}} prefix in {{goldsrc}})
|}
|}
== See also ==
* [[Texture prefixes]]

Latest revision as of 07:22, 20 May 2025

edit
Todo: Better page name; these aren't actually flags, except for the surface flags.

Surface flags

Despite having a 32-bit integer available to be used, most flags go unused. Vanilla Quake engines and GoldSrc only use TEX_SPECIAL.

Bit Flag name Dev comment Notes
0x00000001 TEX_SPECIAL sky or slime, no lightmap or 256 subdivision Surface does not have a lightmap.

Used by Quake QBSP to tell LIGHT to not generate lightmaps for sky and liquid surfaces, which are not subdivided to account for maximum lightmap size (15x15 luxels, or 240x240 texels). ericw-tools additionally uses this on surfaces textured with TRIGGER.

GoldSrc QCSG and HLCSG set this flag on sky surfaces and surfaces textured with AAATRIGGER.

Icon-Bug.pngBug:QCSG and HLCSG still use * to declare liquids as not lightmapped, even though they are prefixed with ! instead. Therefore, QRAD and HLRAD will always lightmap all liquid surfaces, unless they are flagged in some other manner, such as using newbspguy newbspguy.
0x00000002 TEX_MISSING johnfitz -- this texinfo does not have a texture Used by fitzquake and derivatives to indicate a missing texture
0x00000800 ??? N/A Used by VERTEXNORMALS BSPX lump to indicate a face that should have smooth shading based upon its vertex normals.
0x00004000 TEX_SHOULDHIDE this flag is temporary; it might be set after CSG, but will be dropped after BSP Used by VHLT; set if zhlt_hidden is set. Tells HLBSP to not add the face to any visleaves, and will result in HLRAD not reflecting light off of the face.

Texture names with the suffix _HIDDEN will yield the same result, without using this surface flag.

Contents types

Contents are stored as a signed 32-bit integer, and are always negative. Entities are always CONTENTS_SOLID; in GoldSrc GoldSrc, the skin KV to override the contents of any brush entity that inherits CBaseAnimating, but the entity collision type must also be set accordingly.

Clarify: Contents are stored in visleaves somehow, not directly in clipnodes. This is probably related to why they're always negative.
Value Internal name Dev comment Notes
-1 CONTENTS_EMPTY Non-solid, and doesn't affect VIS.
-2 CONTENTS_SOLID Default.
-3 CONTENTS_WATER A liquid, usually water. Textures with the ! prefix are usually water when part of worldspawn, unless they are slime, lava, or a current.
-4 CONTENTS_SLIME Like water, deals damage to the player and some monsters when touched.
-5 CONTENTS_LAVA Like slime, but deals double the damage.
-6 CONTENTS_SKY
-7 CONTENTS_ORIGIN removed at csg time Replaces an entity's origin KV, then is removed by CSG (does not exist in compiled BSP).

In GoldSrc, if a brush has this contents at runtime, it will be treated like water (and is referred to in FGDs as "volumetric light").

-8 CONTENTS_CLIP changed to contents_solid
-9 CONTENTS_CURRENT_0 Acts like water combined with a trigger_push with a speed of 2048 in the given direction.

In Quake, this is treated as regular water, being commented out with an #ifdef QUAKE2.

-10 CONTENTS_CURRENT_90
-11 CONTENTS_CURRENT_180
-12 CONTENTS_CURRENT_270
-13 CONTENTS_CURRENT_UP
-14 CONTENTS_CURRENT_DOWN
-15 CONTENTS_TRANSLUCENT (not in Quake) Like water, but never solid. Despite this, it still affects VIS.
-16 CONTENTS_LADDER (not in Quake) Climbable. Usually set via the game code for the func_ladder entity.
-17 CONTENTS_FLYFIELD (not in Quake) Zero gravity
-18 CONTENTS_GRAVITY_FLYFIELD (not in Quake)
-19 CONTENTS_FOG (not in Quake)

Ambient Types

Ambients are stored as an array of 4 unsigned bytes, indicating volume. Only Quake uses them, and it only uses AMBIENT_SKY and AMBIENT_WATER, which are hardcoded in the engine to play specific sounds when a visleaf containing the given ambient type is in the current PVS.

Confirm:Probably only affected by world brushes, so probably not cast by func_water.
Index Name Notes
0 AMBIENT_WATER Normally cast by any liquid (* prefix in Quake; ! prefix in GoldSrc), unless they are slime or lava.
1 AMBIENT_SKY Normally cast by sky brushes (sky prefix)
2 AMBIENT_SLIME Normally cast by slime brushes (*slime prefix in Quake; !slime prefix in GoldSrc)
3 AMBIENT_LAVA Normally cast by lava brushes (*lava prefix in Quake; !lava prefix in GoldSrc)

See also