This article's documentation is for anything that uses the Source engine. Click here for more information.

BSP flags (Source): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(→‎Surface flags: fill out section)
Line 5: Line 5:
{{modernImportant|{{hammer4|4}} strips these values! Put applicable geometry in an [[instance]] to avoid issues.{{modernConfirm|{{hammer++|4}} might keep the values.}} }}
{{modernImportant|{{hammer4|4}} strips these values! Put applicable geometry in an [[instance]] to avoid issues.{{modernConfirm|{{hammer++|4}} might keep the values.}} }}


== List of flags ==
=== Surface flags ===
=== Surface flags ===
Surface flags on different faces of a brush generally do not need to match. If two or more conflicting flags are assigned, then the flag with the lowest bit value will take priority.
Surface flags on different faces of a brush generally do not need to match. If two or more conflicting flags are assigned, then the flag with the lowest bit value will take priority.
Unlike {{quake2|2}}, surface flags are stored as a 16-bit value instead of a 32-bit value. This is because most information about how to draw the surface can be determined instead at runtime via the [[VMT]].
{| class="wikitable"
{| class="wikitable"
|-
|-
! Bit !! Flag name !! Official description !! Notes
! Bit !! Flag name !! Dev comment !! Description
|-
|-
| 0x0000
| 0x0001
| SURF_LIGHT
| value will hold the light strength
| Normally set on any surface that matches a [[RAD file]] entry.
{{modernConfirm|Can the value field be set in a VMF, or does it require regressing to MAP instead?}}
|-
| 0x0002
| SURF_SKY2D
| don't draw, indicates we should skylight + draw 2d sky but not draw the 3D skybox
|  
|  
|-
| 0x0004
| SURF_SKY
| don't draw, but add to skybox
|  
|  
|-
| 0x0008
| SURF_WARP
| turbulent water warp
| {{modernConfirm|This was for {{quake|nt=0|2|addtext=-style}} water/slime/lava in {{quake2}}; does this still work?}}
|-
| 0x0010
| SURF_TRANS
| None
| Surface is translucent, either via {{cmd|$translucent}} or {{cmd|$alpha}}.
{{modernConfirm|Might also apply to {{cmd|$alphatest}}.
|-
| 0x0020
| SURF_NOPORTAL
| the surface can not have a portal placed on it
|
|-
| 0x0040
| SURF_TRIGGER
| FIXME: This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders
| {{modernConfirm|Might also do something if [[VRAD]] is run with {{code|-nodrawtriggers}}.
|-
| 0x0080
| SURF_NODRAW
| don't bother referencing the texture
|
|-
| 0x0100
| SURF_HINT
| make a primary bsp splitter
|
|-
| 0x0200
| SURF_SKIP
| completely ignore, allowing non-closed brushes
| Should never be used on anything except a hint brush.
|-
| 0x0400
| SURF_NOLIGHT
| Don't calculate light
| Face is unlit.
|-
| 0x0800
| SURF_BUMPLIGHT
| calculate three lightmaps for the surface for bumpmapping
| This is probably why [[ssbump]]s are cheaper to render than regular normal maps.
|-
| 0x1000
| SURF_NOSHADOWS
| Don't receive shadows
| {{confirm|Might be dictated by {{ent|info_no_dynamic_shadow}}?}}
|-
| 0x2000
| SURF_NODECALS
| Don't receive decals
| Given by [[$nodecal]] VMT parm, as well as [[%nopaint]] in {{portal2|2}} and later.
|-
| 0x4000
| SURF_NOCHOP
| Don't subdivide patches on this surface
|
|-
| 0x8000
| SURF_HITBOX
| surface is part of a hitbox
|  
|  
|-
|-
|}
|}


=== Content flags ===
=== Content flags ===

Revision as of 14:01, 22 December 2023

Icon-under construction-blue.png
This is a draft page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.

🖿public/bspflags.h defines bitfields used to tell the game engine and compiler how a brush face should be drawn in-game (surface flags), and what should be inside the brush (contents flags). They are descended from the method used by Quake II.

These are normally defined via Material map compile flags, but they can also be applied directly into a VMF's brush face, using "contents" "####" for contents flags and "flags" "####" for surface flags (wherein #### is the bitfield represented in base 10 form). Some values are also defined via other means, such as func_detail for CONTENTS_DETAIL.

Icon-Important.pngImportant:Hammer Hammer 4.x strips these values! Put applicable geometry in an instance to avoid issues.
Confirm:Hammer++ Hammer++ might keep the values.

List of flags

Surface flags

Surface flags on different faces of a brush generally do not need to match. If two or more conflicting flags are assigned, then the flag with the lowest bit value will take priority.

Unlike Quake II Quake II, surface flags are stored as a 16-bit value instead of a 32-bit value. This is because most information about how to draw the surface can be determined instead at runtime via the VMT.

Bit Flag name Dev comment Description
0x0001 SURF_LIGHT value will hold the light strength Normally set on any surface that matches a RAD file entry.
Confirm:Can the value field be set in a VMF, or does it require regressing to MAP instead?
0x0002 SURF_SKY2D don't draw, indicates we should skylight + draw 2d sky but not draw the 3D skybox
0x0004 SURF_SKY don't draw, but add to skybox
0x0008 SURF_WARP turbulent water warp
Confirm:This was for Quake Quake I-style water/slime/lava in Quake II; does this still work?
0x0010 SURF_TRANS None Surface is translucent, either via $translucent or $alpha.

{{modernConfirm|Might also apply to $alphatest.

0x0020 SURF_NOPORTAL the surface can not have a portal placed on it
0x0040 SURF_TRIGGER FIXME: This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders Might also do something if VRAD is run with -nodrawtriggers.
0x0080 SURF_NODRAW don't bother referencing the texture
0x0100 SURF_HINT make a primary bsp splitter
0x0200 SURF_SKIP completely ignore, allowing non-closed brushes Should never be used on anything except a hint brush.
0x0400 SURF_NOLIGHT Don't calculate light Face is unlit.
0x0800 SURF_BUMPLIGHT calculate three lightmaps for the surface for bumpmapping This is probably why ssbumps are cheaper to render than regular normal maps.
0x1000 SURF_NOSHADOWS Don't receive shadows
Confirm:Might be dictated by info_no_dynamic_shadow?
0x2000 SURF_NODECALS Don't receive decals Given by $nodecal VMT parm, as well as %nopaint in Portal 2 Portal 2 and later.
0x4000 SURF_NOCHOP Don't subdivide patches on this surface
0x8000 SURF_HITBOX surface is part of a hitbox

Content flags

Content flags on different faces of a brush almost always need to match. Mismatched contents will result in Compiler errors, and leaves it up to the Compiler to decide what contents a brush should have. If two or more conflicting flags are assigned, then the flag with the lowest bit value will take priority.

Bit Flag name Official description Notes
0x00000000