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
(→‎Content flags: fill out)
Line 108: Line 108:
|-
|-
| 0x00000000
| 0x00000000
| CONTENTS_EMPTY
| No contents
|  
|  
|-
| 0x00000001
| CONTENTS_SOLID
| an eye is never valid in a solid
|  
|  
|-
| 0x00000002
| CONTENTS_WINDOW
| translucent, but not watery (glass)
|  
|  
|-
| 0x00000004
| CONTENTS_AUX
| (none)
|
|-
| 0x00000008
| CONTENTS_GRATE
| alpha-tested "grate" textures.  Bullets/sight pass through, but solids don't
|
|-
| 0x00000010
| CONTENTS_SLIME
| (none)
|
|-
| 0x00000020
| CONTENTS_WATER
| (none)
|
|-
| 0x00000040
| CONTENTS_BLOCKLOS
| block AI line of sight
|
|-
| 0x00000080
| CONTENTS_OPAQUE
| things that cannot be seen through (may be non-solid though)
|
|-
| 0x00000100
| CONTENTS_TESTFOGVOLUME
| (none)
|
|-
| 0x00000200
| CONTENTS_UNUSED
| (none)
|
|-
| 0x00000400
| CONTENTS_UNUSED6
| Unused<br>NOTE: If it's visible, grab from the top + update LAST_VISIBLE_CONTENTS<br>if not visible, then grab from the bottom.
|
|-
| 0x00000800
| CONTENTS_TEAM1
| rowspan=2 | per team contents used to differentiate collisions<br>between players and objects on different teams
|
|-
| 0x00001000
| CONTENTS_TEAM2
<!-- rowspan above -->
|
|-
| 0x00002000
| CONTENTS_IGNORE_NODRAW_OPAQUE
| ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW
|
|-
| 0x00004000
| CONTENTS_MOVEABLE
| hits entities which are MOVETYPE_PUSH (doors, plats, etc.)
|
|-
| colspan=2 | <!-- Dev comment regarding all subsequent flags -->
| remaining contents are non-visible, and don't eat brushes
| <!-- This space intentionally left blank -->
|-
| 0x00008000
| CONTENTS_AREAPORTAL
| (none)
|
|-
| 0x00010000
| CONTENTS_PLAYERCLIP
| (none)
|
|-
| 0x00020000
| CONTENTS_MONSTERCLIP
| (none)
|
|-
| 0x00040000
| CONTENTS_CURRENT_0
| rowspan=6 | currents can be added to any other contents, and may be mixed
| Effectively identical to a [[trigger_push]] traveling the same direction. Mix these to go in diagonals.
|-
| 0x00080000
| CONTENTS_CURRENT_90
|-
| 0x00100000
| CONTENTS_CURRENT_180
|-
| 0x00200000
| CONTENTS_CURRENT_270
|-
| 0x00400000
| CONTENTS_CURRENT_UP
|-
| 0x00800000
| CONTENTS_CURRENT_DOWN
|-
| 0x01000000
| CONTENTS_ORIGIN
| removed before bsping an entity
|
|-
| 0x02000000
| CONTENTS_MONSTER
| should never be on a brush, only in game
|
|-
| 0x04000000
| CONTENTS_DEBRIS
| (none)
|
|-
| 0x08000000
| CONTENTS_DETAIL
| brushes to be added after vis leafs
| Automatically given to any brushes in a [[func_detail]].
|-
| 0x10000000
| CONTENTS_TRANSLUCENT
| auto set if any surface has trans
| Used for alpha sorting on worldspawn brushes.
|-
| 0x20000000
| CONTENTS_LADDER
| (none)
|
|-
| 0x40000000
| CONTENTS_HITBOX
| use accurate hitboxes on trace
|
|-
| 0x80000000
| N/A
| (none)
| Unused
|-
|-
|}
|}

Revision as of 15:00, 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 Shows only the 2D skybox. Set via $Compile2DSky
0x0004 SURF_SKY don't draw, but add to skybox Shows both the 2D and 3D skybox. Set via $CompileSky
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.
Confirm:Might also apply to $alphatest.
0x0020 SURF_NOPORTAL the surface can not have a portal placed on it Set via %NoPortal
0x0040 SURF_TRIGGER FIXME: This is an xbox hack to work around elimination of trigger surfaces, which breaks occluders Set via %CompileTrigger
Confirm:Might also do something if VRAD is run with -nodrawtriggers.
0x0080 SURF_NODRAW don't bother referencing the texture Set via %CompileNoDraw
0x0100 SURF_HINT make a primary bsp splitter Set via %CompileHint
0x0200 SURF_SKIP completely ignore, allowing non-closed brushes Set via %CompileSkip. Should never be used on anything except a hint brush.
0x0400 SURF_NOLIGHT Don't calculate light Face is unlit. Set via %CompileNoLight if using Alien Swarm or newer or Source 2013.
Confirm:Might be set automatically on UnlitGeneric materials.
0x0800 SURF_BUMPLIGHT calculate three lightmaps for the surface for bumpmapping Implied by $bumpmap.

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 Set via $nodecal. Can also set via %nopaint in Portal 2 Portal 2.
0x4000 SURF_NOCHOP Don't subdivide patches on this surface Set via %CompileNoChop. Has the side effect of affecting triangulation, as well.
0x8000 SURF_HITBOX surface is part of a hitbox [Why?]

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 CONTENTS_EMPTY No contents
0x00000001 CONTENTS_SOLID an eye is never valid in a solid
0x00000002 CONTENTS_WINDOW translucent, but not watery (glass)
0x00000004 CONTENTS_AUX (none)
0x00000008 CONTENTS_GRATE alpha-tested "grate" textures. Bullets/sight pass through, but solids don't
0x00000010 CONTENTS_SLIME (none)
0x00000020 CONTENTS_WATER (none)
0x00000040 CONTENTS_BLOCKLOS block AI line of sight
0x00000080 CONTENTS_OPAQUE things that cannot be seen through (may be non-solid though)
0x00000100 CONTENTS_TESTFOGVOLUME (none)
0x00000200 CONTENTS_UNUSED (none)
0x00000400 CONTENTS_UNUSED6 Unused
NOTE: If it's visible, grab from the top + update LAST_VISIBLE_CONTENTS
if not visible, then grab from the bottom.
0x00000800 CONTENTS_TEAM1 per team contents used to differentiate collisions
between players and objects on different teams
0x00001000 CONTENTS_TEAM2
0x00002000 CONTENTS_IGNORE_NODRAW_OPAQUE ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW
0x00004000 CONTENTS_MOVEABLE hits entities which are MOVETYPE_PUSH (doors, plats, etc.)
remaining contents are non-visible, and don't eat brushes
0x00008000 CONTENTS_AREAPORTAL (none)
0x00010000 CONTENTS_PLAYERCLIP (none)
0x00020000 CONTENTS_MONSTERCLIP (none)
0x00040000 CONTENTS_CURRENT_0 currents can be added to any other contents, and may be mixed Effectively identical to a trigger_push traveling the same direction. Mix these to go in diagonals.
0x00080000 CONTENTS_CURRENT_90
0x00100000 CONTENTS_CURRENT_180
0x00200000 CONTENTS_CURRENT_270
0x00400000 CONTENTS_CURRENT_UP
0x00800000 CONTENTS_CURRENT_DOWN
0x01000000 CONTENTS_ORIGIN removed before bsping an entity
0x02000000 CONTENTS_MONSTER should never be on a brush, only in game
0x04000000 CONTENTS_DEBRIS (none)
0x08000000 CONTENTS_DETAIL brushes to be added after vis leafs Automatically given to any brushes in a func_detail.
0x10000000 CONTENTS_TRANSLUCENT auto set if any surface has trans Used for alpha sorting on worldspawn brushes.
0x20000000 CONTENTS_LADDER (none)
0x40000000 CONTENTS_HITBOX use accurate hitboxes on trace
0x80000000 N/A (none) Unused