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

Core

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
The Citadel Core, which uses this shader.

Core is a pixel shader available in all Source Source games since Half-Life 2: Episode One Half-Life 2: Episode One. It is used to create a unstable, reflecting and refracting core of energy, used exclusively for the Core reactor in the Citadel in Episode One.

Note.pngNote:In order for this shader to work properly, it must be used with a prop_coreball at the position of (2688,12139,5170). This value is hardcoded into the shader.
Note.pngNote:This shader does not exist in engine branches after the Orange Box.

Shader Parameters

The texture to use for the colors that get dynamically modified by the shader. The alpha channel of the $corecolortexture determines the translucency of the core.
The frame to start an animated $corecolortexture on.
$dudvmap <texture> (DX8)
The pattern of refraction is defined by a normal map (DX9+) or DUDV map (DX8-). May be animated.
The frame to start an animated bumpmap on.
Todo: This may not work with the proxy required for the effect.
Transforms the bump map texture.
The default position is center .5 .5 scale 1 1 rotate 0 translate 0 0.
  1. center defines the point of rotation. Only useful if rotate is being used.
  2. scale fits the texture into the material the given number of times. 2 1 is a 50% scale in the horizontal X axis while the vertical Y axis is still at original scale.
  3. rotate rotates the texture counter-clockwise in degrees. Accepts any number, including negatives.
  4. translate shifts the texture by the given numbers. .5 will shift it half-way. 1 will shift it once completely over, which is the same as not moving it at all.
Note.pngNote:All values must be included!
Icon-Bug.pngBug:Scaling the texture may cause odd issues where the Texture Lock tool in Hammer will not actually lock the texture in place.  [todo tested in?]
Icon-Bug.pngBug:Rotating textures applied on brushes will rotate around the map origin (confirm: Orangebox engine only?). A fix for this is to change the center position in the VMT to the brush's origin.  [todo tested in?]
Adds a cubemap reflection on top of the refraction.
Note.pngNote:Specular reflections for this shader will be drawn even if mat_specular is set to 0.
The frame to start an animated cubemap on.
Controls the intensity of the reflection's red, green and blue color channels. Any positive number can be used. Default is "[1 1 1]", which means 100% intensity.
Note.pngNote:You must use quotemarks, as there are space characters within the value.
Controls the contrast of the reflection. 0 is natural contrast, while 1 is the full squaring of the color (i.e. color*color).
Controls the colour saturation of the reflection. 0 is greyscale, while 1 is natural saturation.
Controls the strength of the refraction by multiplying the normal map intensity.
Tints the color of the refraction.
Flowmap to scroll the normal map, which affects the refraction.
The frame to start an animated flowmap on.
The rate at which the normal map scrolls along the flowmap.
Todo: Texture offset for the flowmap? Modified by proxies, as seen below.

Example

The Core material used in Episode One, materials/models/props_combine/core_sheet.vmt

"Core"
{
	"$normalmap" "Models/props_combine/core_normal"
	"$dudvmap"  "Models/props_combine/core_dudv"

	"$corecolortexture" "models/props_combine/corewarpcolor"
	"$flowmap" "models/props_combine/core_flow"

	"$model" 1
	"$REFRACTAmOUNT" "0.15"
	"$FLOWMAPSCROLLRATE" "[.0475 .133]"
//	"$envmap" "CustomCubeMaps/core"
	"$envmap" "env_cubemap"
	"$refracttint" "[0.7 0.7 0.6]"
	"$envmaptint" "[0.8 0.6 0.6]"
	"$FLOWMAPTEXCOORDOFFSET" "1.0"
	"$TempMin" 0
	"$TempMax" 1

	
	"core_dx70"
	{
		"$fallbackmaterial" "models/props_combine/coredx70"
	}

	"core_dx80"
	{
		"$normalmap" "dev/water_normal"
		"$dudvmap"  "dev/water_dudv"
		"$bumptransform" "center .5 .5 scale 5 5 rotate 0 translate 0 0"
		"$envmapcontrast" "1.0"
	}

	"Proxies"
	{

		"Sine"
		{
			"resultVar" "$FLOWMAPTEXCOORDOFFSET"
			"sineperiod" 4
			"sinemin" "$TempMin"
			"sinemax" "$TempMax"
		}
		"AnimatedTexture"
		{
			"animatedtexturevar" "$normalmap" 
			"animatedtextureframenumvar" "$bumpframe"
			"animatedtextureframerate" 29.00
		}
	}
}