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

Brush: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(brushes -> compiled polys)
(→‎Compilation: detail faces obscured by structural faces won't be drawn)
 
(30 intermediate revisions by 21 users not shown)
Line 1: Line 1:
A '''brush''' is a [[Wikipedia:Convex and concave polygons|convex]] 3D shape created with [[Hammer]]'s [[Hammer Block Tool|Block tool]]. Unless tied to an [[Brush entity|entity]] it will form part of the backbone of the map, defining [[visibility]] as a [[worldspawn|world brush]].
{{LanguageBar}}{{Goldsrc topicon}}{{Source topicon}}
A '''brush''' is a [[Wikipedia:Polygon#Convexity and non-convexity|convex]] 3D shape created with [[Hammer]]'s [[Hammer Block Tool|Block Tool]]. Brushes are used by level designers to define the shape of the [[world]] (which defines [[visibility]]) and to create [[brush entity|brush entities]].


Brushes are each unique, can't sustain huge amounts of detail, and are lit with pre-computed [[lightmap]]s. They are complimented by [[model]]s, which are more dynamic, more detailed, and exactly the same whenever and wherever used.
When a map is compiled [[VBSP]] converts brush faces that touch a [[visleaf]] to [[Wikipedia:Constructive solid geometry|groups of polygons]]. The resulting 'brush models' are stored within the BSP file and can be claimed by entities (e.g. the world, or your brush entity). The original brushes are retained in the BSP, though the benefits of this are not clear.


== In-game ==
In comparison to [[model]]s, brushes are:


Brushes are compiled by [[VBSP]] into individual polygons, which means that unless tied to an entity they only exist as discrete objects in Hammer.
* Unique every time
* Low-detail and [[cheap]]
* Lit with pre-computed [[lightmap]]s
* Rigid (cannot [[Skeletal animation|deform]])


As a part of this process faces are merged and chopped so that parts touching either the void or one another are removed. You can see some scenarios in this image:
== Compilation ==


[[Image:Optimize.jpg|750px|center|Brushes and their in-game result]]
# For each individual brush model, only faces that touch a visleaf are compiled. Some of the results of this process can be seen below:


Exceptions are:
[[File:Brushes compiled.png|750px|Brushes and their compiled equivalents]]


* [[Brush entity|Brush entities]], which merge and chop only within themselves.
** [[func_detail]]s will also merge and chop each other (since they are really all the same entity).
* Brushes with [[$translucent|translucent]] materials applied, which do not merge or chop at all.


Don't bother coating the inner surfaces of brush constructions with [[nodraw]] unless they meet one of the above criteria.
# If some parts of a brush face touch visleaves and others do not, the face will be chopped up to remove the hidden area.


{{note|Surfaces that are merely flush with one another will not be merged. Doing so would disrupt texturing.}}
There are two exceptions to these rules:
 
* Although they are discrete entities in Hammer, [[func detail]]s are all merged into one during compile. You do not need to [[nodraw]] hidden 'detail-to-detail' faces in (but you ''do'' need to nodraw structural-to-detail in {{src}}).
* Faces with [[$translucent|translucent]] materials applied are never chopped. Don't apply them to internal or hidden surfaces unless you really mean to.
 
== Limits ==
 
VBSP enforces these limits:
 
* 8192 brushes (65535 in {{GMOD}})
* 128 faces on a single brush
* 32768 faces overall (half of the BSP plane limit, each face uses two planes)
 
Invisible brushes like [[trigger multiple|triggers]] and even [[hint brush]]es count toward the limit. Faces like NODRAW do not count toward the limit. Faces textured with NODRAW are removed during compile, so only its collisions, boundings, and place in the world remain. Note that faces may be split up by the compiler, counting them further toward the limit.
 
{{tip|It is possible to compile a custom build of VBSP with these limits changed or removed, but the engine's behaviour is undefined.}}
 
Even if a brush doesn't count towards VBSP's face limit, it will still count towards the engine's [[brushside]] limit, which is 65535.


== See also ==
== See also ==


* [[Introduction to Editing]]
* [[Introduction to Editing]]
* [[Brush Creation]]
* [[Basic Construction]]
* [[Mesh#Source 2|Mesh (Source 2)]]
* [[Model]]
* [[Model]]
* [[Displacement]]
* [[Displacement]]
{{otherlang:en}}
{{otherlang:en:pt|Brush:pt}},
{{otherlang:en:pt-br|Brush:pt-br}},
{{otherlang:en:ru|Brush:ru}}


[[Category:Level Design]]
[[Category:Level Design]]
[[Category:Glossary]]
[[Category:Glossary]]

Latest revision as of 20:23, 29 June 2025

English (en)Deutsch (de)Español (es)Português (pt)Português do Brasil (pt-br)Русский (ru)Українська (uk)中文 (zh)Translate (Translate)

A brush is a convex 3D shape created with Hammer's Block Tool. Brushes are used by level designers to define the shape of the world (which defines visibility) and to create brush entities.

When a map is compiled VBSP converts brush faces that touch a visleaf to groups of polygons. The resulting 'brush models' are stored within the BSP file and can be claimed by entities (e.g. the world, or your brush entity). The original brushes are retained in the BSP, though the benefits of this are not clear.

In comparison to models, brushes are:

Compilation

  1. For each individual brush model, only faces that touch a visleaf are compiled. Some of the results of this process can be seen below:

Brushes and their compiled equivalents


  1. If some parts of a brush face touch visleaves and others do not, the face will be chopped up to remove the hidden area.

There are two exceptions to these rules:

  • Although they are discrete entities in Hammer, func details are all merged into one during compile. You do not need to nodraw hidden 'detail-to-detail' faces in (but you do need to nodraw structural-to-detail in Source).
  • Faces with translucent materials applied are never chopped. Don't apply them to internal or hidden surfaces unless you really mean to.

Limits

VBSP enforces these limits:

  • 8192 brushes (65535 in Garry's Mod)
  • 128 faces on a single brush
  • 32768 faces overall (half of the BSP plane limit, each face uses two planes)

Invisible brushes like triggers and even hint brushes count toward the limit. Faces like NODRAW do not count toward the limit. Faces textured with NODRAW are removed during compile, so only its collisions, boundings, and place in the world remain. Note that faces may be split up by the compiler, counting them further toward the limit.

Tip.pngTip:It is possible to compile a custom build of VBSP with these limits changed or removed, but the engine's behaviour is undefined.

Even if a brush doesn't count towards VBSP's face limit, it will still count towards the engine's brushside limit, which is 65535.

See also