Newxog global: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:newxog_global.gif|frame|right|newxog_global in bm_c4a1b.]]
{{This is a|logical entity|name=newxog_global|game=Black Mesa|sprite=xog_global.png}} Xog (short for Xen Fog) is Screenspace Fog, very flexible new fog system that replaces Source's legacy fog. The new xog can be configured on the fly with instant results ingame, it can change over time with I/O, and it can vary in density and color based on height. Along with its tons of options, is that it became (sort of) the preferred way for level designers to do color corrections in the xen part of the game instead of the old [[Color Correction|color correction]] entity provided by Source Engine. Uses [https://camo.githubusercontent.com/23620b7b0f0e7fe08922b332f0a306e5644247a2de5807f2b60b3297ce170f41/68747470733a2f2f692e696d6775722e636f6d2f624f4339695a752e706e67 radial fog] instead of deprecated planar/z fog. On top of 3 colors for blending, it support both 1D and cubemap gradient textures. The game also have console-based [[Xog Editor]] which can select and edit almost every property of any xog entity.
{{This is a|point entity|name=newxog_global|game=Black Mesa|sprite=xog_global.png}} Xog (short for Xen Fog) is Screenspace Fog, very flexible new fog system that replaces Source's legacy fog. The new xog can be configured on the fly with instant results ingame, it can change over time with I/O, and it can vary in density and color based on height. Along with its tons of options, is that it became (sort of) the preferred way for level designers to do color corrections in the xen part of the game instead of the old [[Color Correction|color correction]] entity provided by Source Engine. Uses [https://camo.githubusercontent.com/23620b7b0f0e7fe08922b332f0a306e5644247a2de5807f2b60b3297ce170f41/68747470733a2f2f692e696d6775722e636f6d2f624f4339695a752e706e67 radial fog] instead of deprecated planar/z fog. On top of 3 colors for blending, it support both 1D and cubemap gradient textures. The game also have console-based [[Xog Editor]] which can select and edit almost every property of any xog entity.
{{CDA|CNewXogGlobal|CBaseEntity|}}
[[File:newxog_global.gif|thumb|right|newxog_global in bm_c4a1b.]]
{{important|This entity doesn't affect optimization, this entity is for visual effects only. Combine with [[env_fog_controller]].}}
{{important|This entity doesn't affect optimization, this entity is for visual effects only. Combine with [[env_fog_controller]].}}
{{warning|Xog use expensive [https://learnopengl.com/Advanced-Lighting/Deferred-Shading gbuffer], that means that with this entity your scene rendering at least 5 times, which makes your level very expensive, considering that [[XenEngine]] uses 32-bit architecture and [[DirectX_Versions|DirectX]] 9 rendering. In large quantities, xog entities can greatly heat up your computer and also cause large FPS drops (depending on difficulty of your map and how your area open). Use wisely.}}
{{todo|Rework page and replace .gif files with video links.}}
{{bms}} Represented by class <code>CNewXogGlobal</code>.
{{back | Black Mesa Level Creation}}
 
==Keyvalues==
==Keyvalues==
{{KV Targetname}}
{{KV|Enabled|intn=Enabled|Choices|
{{KV|Enabled|intn=Enabled|Choices|Enable/Disable this Entity.
Determines is this entity enabled or disabled on spawn.
Determines is this entity enabled or disabled on spawn.
*0: Enabled
*0: Enabled
Line 14: Line 11:
}}
}}
{{KV|Xog Type|intn=xogtype|Choices|
{{KV|Xog Type|intn=xogtype|Choices|
Determines xog type. Global - render xog in world space only. GlobalWithSky - render xog in world space and add third layer for [[skybox]] (without color blending, uses <code>skyColor</code> instead). SkyOnly - xog will be applied to skybox with color blending, <code>skyBlendFactor</code> will not work, decreased intensity will show a "black void" instead of skybox.
Determines xog type.
*0:0: Global
 
*1:1: GlobalWithSky
*0:0: Global - render xog in world space only.
*2:2: SkyOnly
*1:1: GlobalWithSky - render xog in world space and add third layer for [[skybox]] (without color blending, uses <code>skyColor</code> instead).
*2:2: SkyOnly - xog will be applied to skybox with color blending, <code>skyBlendFactor</code> will not work, decreased intensity will show a "black void" instead of skybox.
}}
}}
{{expand|title=Examples|
{{expand|title=Examples|
Line 55: Line 53:
}}
}}
{{KV|Color Mode|intn=colormode|Choices|
{{KV|Color Mode|intn=colormode|Choices|
Determines color mode. With StaticColor it will use color from <code>colorBottom</code> and <code>colorTop</code>, doesn't affects color in skybox. With 1DGradTexture, color will depends on texture from <code>Grad Texture</code>, doesn't affects color in skybox.  
Determines color mode. With StaticColor doesn't affects color in skybox. With 1DGradTexture, color will depends on texture from <code>Grad Texture</code>, doesn't affects color in skybox.  
*0:0: StaticColor
*0:0: StaticColor - xog will use colors from <code>colorBottom</code> and <code>colorTop</code>. Also will blend the colors. For 2D skybox, it will use color single color from <code>skyColor</code> (if used  <code>GlobalWithSky</code> xog type).
*1:1: 1DGradTexture
*1:1: 1DGradTexture - xog will use texture from <code>Grad Texture</code> and use it as 1D texture.
*2:2: CubeGradTexture
*2:2: CubeGradTexture - xog will use texture from <code>Grad Texture</code> and use it as [[cubemap]] texture, it will use black color for xog the fog and will not use colors from the properties.{{tip|Follow [[$envmap#Creating_a_custom_static_cubemap_texture|this]] steps if you want to create your own texture for this color mode.}}
}}
}}
{{expand|title=Examples|
{{expand|title=Examples|
<br>
<br>
Line 65: Line 64:
File:colormode1.jpg|StaticColor
File:colormode1.jpg|StaticColor
File:colormode2.jpg|1DGradTexture (in this picture, xog doesn't use any texture, the engine replaces missing texture with the chessboard, this is why the color is purple.
File:colormode2.jpg|1DGradTexture (in this picture, xog doesn't use any texture, the engine replaces missing texture with the chessboard, this is why the color is purple.
File:colormode3.jpg|CubeGradTexture
File:colormode3nn.jpg|CubeGradTexture (used <code>lights/lightcookie_int_cyst</code> texture).
</gallery>
</gallery>
}}
}}
{{KV|Grad Texture|intn=texname|string|
{{KV|Grad Texture|intn=texname|string|
Grad texture to use.
Grad texture to use. Grad texture uses [[.vtf]] file and not [[.vmt]]. Works only if <code>Color Mode</code> value is <code>1DGradTexture</code> or <code>CubeGradTexture</code>.
Grad texture uses [[.vtf]] file and not [[.vmt]]. Works only if <code>Color Mode</code> value is <code>1DGradTexture</code>.


<code>colorTop</code> will use texture itself to render, <code>colorBottom</code> will use main color of chosen texture to render.
<code>colorTop</code> will use texture itself to render, <code>colorBottom</code> will use main color of chosen texture to render.
Line 79: Line 77:


With <code>Global</code> and <code>GlobalWithSky</code> xog type, it will be applied only in world space. With <code>SkyOnly</code>, it will be applied in skybox. If you want to have it for world space and sky together - you can use 2 entities as workaround, first xog will use <code>Global</code> type, second will use <code>SkyOnly</code> type.
With <code>Global</code> and <code>GlobalWithSky</code> xog type, it will be applied only in world space. With <code>SkyOnly</code>, it will be applied in skybox. If you want to have it for world space and sky together - you can use 2 entities as workaround, first xog will use <code>Global</code> type, second will use <code>SkyOnly</code> type.
{{confirm|Special [[gradient]] textures should be used.}}
}}
{{confirm|Is it used in {{bms|4}} campaign ?
}}
{{expand|title=Example of how it works with <code>Global</code> and <code>GlobalWithSky</code>.|
{{expand|title=Example of how it works with <code>Global</code> and <code>GlobalWithSky</code>.|
<br>
<gallery mode=packed heights=290px widths=520px>
<gallery mode=packed heights=290px widths=520px>
File:GradTextureGlobal.gif|Used dev/xog_grad_1d.vtf texture. Using [[Xog Editor]] to change values.
File:GradTextureGlobal.gif|Used dev/xog_grad_1d.vtf texture. Using [[Xog Editor]] to change values.
Line 94: Line 87:
File:GradTextureSky.gif|Used dev/xog_grad_1d.vtf texture. Using [[Xog Editor]] to change values.
File:GradTextureSky.gif|Used dev/xog_grad_1d.vtf texture. Using [[Xog Editor]] to change values.
</gallery>
</gallery>
}}
}}
}}
{{KV|colorTop|intn=colortop|color255|
{{KV|colorTop|intn=colortop|color255|
Line 99: Line 93:
}}
}}
{{expand|title=Examples|
{{expand|title=Examples|
<br>
<gallery mode=nolines heights=500px widths=520px>
<gallery mode=nolines heights=500px widths=520px>
File:Gcolortop1.jpg|colorTop - 255 0 0. colorBottom - 60 0 180.
File:Gcolortop1.jpg|colorTop - 255 0 0. colorBottom - 60 0 180.
Line 118: Line 111:
</gallery>
</gallery>
}}
}}
{{KV|distStart|intn=diststart|float|distStart
{{KV|distStart|intn=diststart|float|
Xog start draw distance.
Xog start draw distance.
}}
}}
Line 129: Line 122:
</gallery>
</gallery>
}}
}}
{{KV|distEnd|intn=distend|float|distEnd
{{KV|distEnd|intn=distend|float|
Xog end draw distance.
Xog end draw distance.
}}
}}
Line 140: Line 133:
</gallery>
</gallery>
}}
}}
{{KV|distDensity|intn=distdensity|float|distDensity
{{KV|distDensity|intn=distdensity|float|
Density of xog entity, only values from 0 to 1 works.
Density of xog entity, only values from 0 to 1 works.
}}
}}
Line 151: Line 144:
</gallery>
</gallery>
}}
}}
{{KV|opacityOffsetTop|intn=opacityoffsettop|float|opacityOffsetTop
{{KV|opacityOffsetTop|intn=opacityoffsettop|float|
Offsets top color of xog.
Offsets top color of xog.
}}
}}
Line 162: Line 155:
</gallery>
</gallery>
}}
}}
{{KV|opacityOffsetBottom|intn=opacityoffsetbottom|float|opacityOffsetBottom
{{KV|opacityOffsetBottom|intn=opacityoffsetbottom|float|
Offsets bottom color of xog.
Offsets bottom color of xog.
}}
}}
Line 173: Line 166:
</gallery>
</gallery>
}}
}}
{{KV|htZStart|intn=htzstart|float|htZStart
{{KV|htZStart|intn=htzstart|float|
Height that xog starts rendering at.
Height that xog starts rendering at.
}}
}}
Line 184: Line 177:
</gallery>
</gallery>
}}
}}
{{KV|htZEnd|intn=htzend|float|htZEnd
{{KV|htZEnd|intn=htzend|float|
Height that xog stops rendering at.
Height that xog stops rendering at.
}}
}}
Line 195: Line 188:
</gallery>
</gallery>
}}
}}
{{KV|htZColStart|intn=htzcolstart|float|htZColStart
{{KV|htZColStart|intn=htzcolstart|float|
Height that xog color starts rendering at. Results depend on <code>htZColEnd</code> value.
Height that xog color starts rendering at. Results depend on <code>htZColEnd</code> value.
}}
}}
Line 206: Line 199:
</gallery>
</gallery>
}}
}}
{{KV|htZColEnd|intn=htzcolend|float|htZColEnd
{{KV|htZColEnd|intn=htzcolend|float|
Height that xog color stops rendering at. Results depend on <code>htZColStart</code> value.
Height that xog color stops rendering at. Results depend on <code>htZColStart</code> value.
}}
}}
Line 283: Line 276:
</gallery>
</gallery>
}}
}}
{{KV|RadiusX|intn=radiusz|float|RadiusX
{{KV|RadiusX|intn=radiusz|float|Radius along world X axis. It may have been an alternative to {{ent|newxog_volume}} until it was implemented, or it's just [[FGD]] leftover.|deprecated=1
}}
{{KV|RadiusY|intn=radiusy|float|RadiusY
}}
}}
{{KV|RadiusZ|intn=radiusz|float|RadiusZ
{{KV|RadiusY|intn=radiusy|float|Radius along world Y axis. It may have been an alternative to {{ent|newxog_volume}} until it was implemented, or it's just [[FGD]] leftover.|deprecated=1
}}
}}
{{confirm|Are RadiusX, RadiusY and RadiusZ a deprecated properties ? These seems to be non functional, there is also no information in <code>xogscripts.cfg</code>. The same have {{ent|env_cascade_volume}}.
{{KV|RadiusZ|intn=radiusz|float|Radius along world Z axis. It may have been an alternative to {{ent|newxog_volume}} until it was implemented, or it's just [[FGD]] leftover.|deprecated=1
}}
}}
{{KV|skyColorTop|intn=skycolortop|color255|Xog top color in skybox. Can be found in [[.vmf]] files of some xen levels. Use <code>colorTop</code> instead.|nofgd=1|deprecated=1}}
{{KV|skyColorTop|intn=skycolortop|color255|Xog top color in skybox. Can be found in [[.vmf]] files of some xen levels. Use <code>colorTop</code> instead.|nofgd=1|deprecated=1}}
Line 400: Line 391:
File:SkyXB1.jpg| frame |GlobalWithSky.
File:SkyXB1.jpg| frame |GlobalWithSky.
File:SkyXB2.jpg| frame |SkyOnly.
File:SkyXB2.jpg| frame |SkyOnly.
</gallery>
====SkyOnly buggy====
<code>SkyOnly</code> type have weird triangles.
{{confirm|There is no way to fix this.}}
<gallery mode=packed heights=350px widths=320px>
File:MasonTringle.jpg| frame |An example.
</gallery>
</gallery>



Latest revision as of 06:29, 27 May 2025

Xog global.png

newxog_global is a logical entity available in Black Mesa Black Mesa. Xog (short for Xen Fog) is Screenspace Fog, very flexible new fog system that replaces Source's legacy fog. The new xog can be configured on the fly with instant results ingame, it can change over time with I/O, and it can vary in density and color based on height. Along with its tons of options, is that it became (sort of) the preferred way for level designers to do color corrections in the xen part of the game instead of the old color correction entity provided by Source Engine. Uses radial fog instead of deprecated planar/z fog. On top of 3 colors for blending, it support both 1D and cubemap gradient textures. The game also have console-based Xog Editor which can select and edit almost every property of any xog entity.

C++ Class hierarchy
CNewXogGlobal
CBaseEntity
newxog_global in bm_c4a1b.
Icon-Important.pngImportant:This entity doesn't affect optimization, this entity is for visual effects only. Combine with env_fog_controller.
Todo: Rework page and replace .gif files with video links.

Keyvalues

Enabled (Enabled) <choices>
Determines is this entity enabled or disabled on spawn.
  • 0: Enabled
  • 1: Disabled
Xog Type (xogtype) <choices>
Determines xog type.
  • 0:0: Global - render xog in world space only.
  • 1:1: GlobalWithSky - render xog in world space and add third layer for skybox (without color blending, uses skyColor instead).
  • 2:2: SkyOnly - xog will be applied to skybox with color blending, skyBlendFactor will not work, decreased intensity will show a "black void" instead of skybox.
Examples


Icon-Important.pngImportant:You can have only one GlobalWithSky or Global with SkyOnly (separately as well) in your level. Otherwise, game will crash on map launch with this engine error message.


skyColor (skycolor) <color255>
Xog color in 2D skybox.
Examples


skyBlendFactor (skyblendfactor) <float>
Xog intensity in skybox. This is a float value from 0.0 to 1.0.
Examples


Color Mode (colormode) <choices>
Determines color mode. With StaticColor doesn't affects color in skybox. With 1DGradTexture, color will depends on texture from Grad Texture, doesn't affects color in skybox.
  • 0:0: StaticColor - xog will use colors from colorBottom and colorTop. Also will blend the colors. For 2D skybox, it will use color single color from skyColor (if used GlobalWithSky xog type).
  • 1:1: 1DGradTexture - xog will use texture from Grad Texture and use it as 1D texture.
  • 2:2: CubeGradTexture - xog will use texture from Grad Texture and use it as cubemap texture, it will use black color for xog the fog and will not use colors from the properties.
    Tip.pngTip:Follow this steps if you want to create your own texture for this color mode.
Examples


Grad Texture (texname) <string>
Grad texture to use. Grad texture uses .vtf file and not .vmt. Works only if Color Mode value is 1DGradTexture or CubeGradTexture.

colorTop will use texture itself to render, colorBottom will use main color of chosen texture to render.

htZColStart will set texture position. htZColEnd will scale texture.

htZStart will set main color start position, htZEnd will scale main color.

With Global and GlobalWithSky xog type, it will be applied only in world space. With SkyOnly, it will be applied in skybox. If you want to have it for world space and sky together - you can use 2 entities as workaround, first xog will use Global type, second will use SkyOnly type.

Example of how it works with Global and GlobalWithSky.
Example of how it works with SkyOnly.


colorTop (colortop) <color255>
Xog top color.
Examples
colorBottom (colorbottom) <color255>
Xog bottom color.
Note.pngNote:Top and bottom colors blending in xog center, for example with red and green colors the center of xog will be yellow.
Examples


distStart (diststart) <float>
Xog start draw distance.
Examples


distEnd (distend) <float>
Xog end draw distance.
Examples


distDensity (distdensity) <float>
Density of xog entity, only values from 0 to 1 works.
Examples


opacityOffsetTop (opacityoffsettop) <float>
Offsets top color of xog.
Examples


opacityOffsetBottom (opacityoffsetbottom) <float>
Offsets bottom color of xog.
Examples


htZStart (htzstart) <float>
Height that xog starts rendering at.
Examples


htZEnd (htzend) <float>
Height that xog stops rendering at.
Examples


htZColStart (htzcolstart) <float>
Height that xog color starts rendering at. Results depend on htZColEnd value.
Examples


htZColEnd (htzcolend) <float>
Height that xog color stops rendering at. Results depend on htZColStart value.
Examples


noise1ScrollSpeed (noise1scrollspeed) <vector>
Layer one, speed at which noise moves trough xog volume (X Y Z).
Examples


noise1Tiling (noise1tiling) <vector>
Layer one, tiling speed at which noise moves trough xog volume (X Y Z).
Examples


noise2ScrollSpeed (noise2scrollspeed) <vector>
Layer two, speed at which noise moves trough xog volume (X Y Z).
Examples


noise2Tiling (noise2tiling) <vector>
Layer two, tiling speed at which noise moves trough xog volume (X Y Z).
Examples


noiseContrast (noisecontrast) <float>
Contrast of xog.
Examples


noiseMultiplier (noisemultiplier) <float>
Multiplier of xog.
Examples


RadiusX (radiusz) <float> Obsolete
Deprecated.
Radius along world X axis. It may have been an alternative to newxog_volume until it was implemented, or it's just FGD leftover.
RadiusY (radiusy) <float> Obsolete
Deprecated.
Radius along world Y axis. It may have been an alternative to newxog_volume until it was implemented, or it's just FGD leftover.
RadiusZ (radiusz) <float> Obsolete
Deprecated.
Radius along world Z axis. It may have been an alternative to newxog_volume until it was implemented, or it's just FGD leftover.
skyColorTop (skycolortop) <color255> !FGD Obsolete
Deprecated.
Xog top color in skybox. Can be found in .vmf files of some xen levels. Use colorTop instead.
skyColorBottom (skycolorbottom) <color255> !FGD Obsolete
Deprecated.
Xog bottom color in skybox. Can be found in .vmf files of some xen levels. Use colorBottom instead.
gtZColStart (gtzcolstart) <color255> !FGD Obsolete
Deprecated.
gtZColStart. Can be found in .vmf files of some xen levels.
gtZColEnd (gtzcolend) <color255> !FGD Obsolete
Deprecated.
gtZColEnd. Can be found in .vmf files of some xen levels.

Inputs

TurnOn <void>
Turn the xog on.
TurnOff <void>
Turn the xog off.
Toggle <void>
Toggle the xog current state.

Bugs/Limitations

Xog incorrect work with $translucent

Xog all time fully rendering through everything with material shader parameter $translucent. This happen because of game can't tell the depth of scene because of the transparency.



This problem also applies to brushes which not have $translucent, but which parented to brushes that have this parameter. Similar will happen if brush with $translucent is part of your brush entity. Same will happen if you use overlays/decals on brushes with $translucent.

This issues does not happen if replace LightmappedGeneric to ShatteredGlass or UnlitGeneric, so, you can use one of them for glass or transparency surfaces when it's needed.

In some cases use $alphatest if it'll give similar to $translucent resualts.


Xog incorrect work with $alphatestreference and $allowalphatocoverage

$alphatestreference is a material shader parameter that specifies the threshold alpha channel value at which the surface should be transparent instead of opaque, default "0.5". $allowalphatocoverage creates translucent steps based on alpha values. Both have one and same problems with gbuffer. For examples used this texture with this alpha channel.

Here xog placed behind wall with the texture. We can see the circle part of that have alpha channel part which is invisible due to $alphatest, with enabled xog we see that the invisible part doesn't show through itself xog.

If use very low numbers you will see resualts like in the pictures.


You can't escape this problem, only minimize effect with $alphatestreference 0.1 or if paint alpha correct channel.


Motion blur blurring viewmodel xog layer

For some reason Motion blur blurring viewmodel xog layer, you can notice this when you just rotate camera.


Xog incorrect work with -tools

If you don't use Full Screen - xog will incorrectly applying to screen.


Xog doesn't refract by refract shader and fully draw through

Unlike deferred lighting, xog doesn't refract by refract shader, also fully draw through.

This is why underwater plants in some xen levels so weird refracting if.

If model with refraction behind wall with refraction - this cause issues like this.

Similar issue with cloak material shader parameter.

Sky xog works incorrectly with newxog_volume

Both GlobalWithSky and SkyOnly always fully shows through xog volumes.

Overwater layer

You can note a strange layer when submerging in water.


See also