Bmodel: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(newbspguy works with Quake I)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
A '''bmodel''' (short for '''brush model''') is a [[model]] made out of [[BSP]] brushes. These are normally called from within the currently loaded BSP map file. Each bmodel uses its own [[BSP tree]]; there is a bmodel for [[worldspawn]], as well as bmodels for each [[brush entity]].
A '''bmodel''' (short for '''brush model''') is a [[model]] made out of [[BSP]] brushes. These are normally called from within the currently loaded BSP map file. Each bmodel uses its own [[BSP tree]]; there is a bmodel for [[worldspawn]], as well as bmodels for each [[brush entity]].


The [[struct]] used to define bmodels in {{file|bspfile|h}} is {{code|dmodel_t}}. The "D" might stand for "display", being consistent with other structs in the file.
The [[struct]] used to define bmodels in {{src}} {{file|bspfile|h}} is {{code|dmodel_t}}. The "D" might stand for "display", being consistent with other structs in the file.


With the exception of the bmodel used by [[worldspawn]], are called from an [[entity]] using {{code|<nowiki>*#</nowiki>}} in the {{code|model}} [[KV]], wherein # is an [[integer]] index representing the location of the bmodel in the BSP file. Worldspawn always uses bmodel 0, and does not require a {{code|model}} key; in fact, bmodel 0 cannot be loaded via the {{code|model}} key.
With the exception of the bmodel used by [[worldspawn]], bmodels are called from an [[entity]] using {{code|<nowiki>*#</nowiki>}} in the {{code|model}} [[KV]], wherein # is an [[integer]] index representing the location of the bmodel in the BSP file. Worldspawn always uses bmodel 0, and does not require a {{code|model}} key; in fact, bmodel 0 cannot be loaded via the {{code|model}} key.


* In {{quake|4.1}}, and by extension {{gldsrc|4.1}}, any entity can use bmodels from a separate BSP file from the currently loaded map. If a bmodel is loaded from a separate BSP separate, the worldspawn bmodel will be used.
* In {{quake|4.1}}, and by extension {{gldsrc|4.1}}, any entity can use bmodels from a separate BSP file from the currently loaded map. If a bmodel is loaded from a separate BSP separate, the worldspawn bmodel will be used.
:{{note|All [[point entity|point entities]] can use [[MDL]]s, [[SPR]]s, bmodels, and separate [[BSP]] models interchangeably in {{quake|4.1}} and {{goldsrc|4.1}}.<br>Some brush entities, such as {{ent|func_illusionary (GoldSrc)|alt=func_illusionary}} or {{ent|func_healthcharger (GoldSrc)|alt=func_healthcharger}} can be used as point entities this way, although the defined model must have been prechached.{{tip|In [[VHLT]], pointing {{code|zhlt_usemodel}} to a {{ent|cycler (GoldSrc)|alt=cycler}} can be used to streamline this process, ensuring the entities are defined in the correct order in the compiled BSP.}}}}
:{{note|All [[point entity|point entities]] can use [[MDL]]s, [[SPR]]s, bmodels, and separate [[BSP]] models interchangeably in {{quake|4.1}} and {{goldsrc|4.1}}.<br>Some brush entities, such as {{ent|func_illusionary (GoldSrc)|alt=func_illusionary}} or {{ent|func_healthcharger (GoldSrc)|alt=func_healthcharger}} can be used as point entities this way, although the defined model must have been [[precache]]d.{{tip|In [[VHLT]], pointing {{code|zhlt_usemodel}} to a {{ent|cycler (GoldSrc)|alt=cycler}} can be used to streamline this process, ensuring the entities are defined in the correct order in the compiled BSP.}}}}
:{{modernImportant|Bmodels contained in separate BSPs are usually fullbright, because they cannot inherit lighting info from the world.{{tip|Use [[ericw-tools]] and compile with {{code|-dirtdebug}} to apply some generic ambient occlusion to the standalone BSP model's lightmaps, improving visibility, or  manually paint lightmaps with [[newbspguy]].}} }}
:{{modernImportant|Bmodels contained in separate BSPs are usually fullbright, because they cannot inherit lighting info from the world.{{tip|Use [[ericw-tools]] and compile with {{code|-dirtdebug}} to apply some generic ambient occlusion to the standalone BSP model's lightmaps, improving visibility, or  manually paint lightmaps with [[newbspguy]].}} }}
* In {{quake2|4.1}}, and by extension {{src|4.1}}, only bmodels built into the current [[map]] can be used.{{confirm}}
* In {{quake2|4.1}}, and by extension {{src|4.1}}, only bmodels built into the current [[map]] can be used.{{confirm}}
:{{note|Although the {{code|model}} KV is used for bmodels, sprites, and [[MDL]] models, they are not interchangeable in {{src|4}}{{confirm}}. In {{quake2|4}}, only [[MD2]] models and [[SP2]] sprites are interchangeable.}}
:{{note|Although the {{code|model}} KV is used for bmodels, sprites, and [[MDL]] models, only [[MDL]] models and sprites are interchangeable in {{src|4}} {{confirm}}. Likewise, in {{quake2|4}}, only [[MD2]] models and [[SP2]] sprites are interchangeable.}}


[[Category:Glossary]]
[[Category:Glossary]]

Latest revision as of 08:00, 21 November 2025

A bmodel (short for brush model) is a model made out of BSP brushes. These are normally called from within the currently loaded BSP map file. Each bmodel uses its own BSP tree; there is a bmodel for worldspawn, as well as bmodels for each brush entity.

The struct used to define bmodels in Source 🖿bspfile.h is dmodel_t. The "D" might stand for "display", being consistent with other structs in the file.

With the exception of the bmodel used by worldspawn, bmodels are called from an entity using *# in the model KV, wherein # is an integer index representing the location of the bmodel in the BSP file. Worldspawn always uses bmodel 0, and does not require a model key; in fact, bmodel 0 cannot be loaded via the model key.

  • In Quake Quake, and by extension GoldSrc GoldSrc, any entity can use bmodels from a separate BSP file from the currently loaded map. If a bmodel is loaded from a separate BSP separate, the worldspawn bmodel will be used.
Note.pngNote:All point entities can use MDLs, SPRs, bmodels, and separate BSP models interchangeably in Quake Quake and GoldSrc GoldSrc.
Some brush entities, such as func_illusionary or func_healthcharger can be used as point entities this way, although the defined model must have been precached.
Tip.pngTip:In VHLT, pointing zhlt_usemodel to a cycler can be used to streamline this process, ensuring the entities are defined in the correct order in the compiled BSP.
Icon-Important.pngImportant:Bmodels contained in separate BSPs are usually fullbright, because they cannot inherit lighting info from the world.
Tip.pngTip:Use ericw-tools and compile with -dirtdebug to apply some generic ambient occlusion to the standalone BSP model's lightmaps, improving visibility, or manually paint lightmaps with newbspguy.
  • In Quake II Quake II, and by extension Source Source, only bmodels built into the current map can be used.[confirm]
Note.pngNote:Although the model KV is used for bmodels, sprites, and MDL models, only MDL models and sprites are interchangeable in Source Source [confirm]. Likewise, in Quake II Quake II, only MD2 models and SP2 sprites are interchangeable.