Difference between revisions of "Core (shader)"

From Valve Developer Community
Jump to: navigation, search
(Created Core shader page)
 
m (envmaps will are force drawn)
Line 19: Line 19:
 
; <code>[[$envmap]] <texture></code>
 
; <code>[[$envmap]] <texture></code>
 
: Adds a cubemap reflection on top of the refraction.
 
: Adds a cubemap reflection on top of the refraction.
 +
: {{note|Specular reflections will be drawn even if <code>mat_specular</code> is set to 0}}
 
; <code>$envmapframe <int></code>
 
; <code>$envmapframe <int></code>
 
: The frame to start an animated cubemap on.
 
: The frame to start an animated cubemap on.

Revision as of 03:01, 2 June 2019

The Citadel Core, which uses this shader.

Core is a material shader introduced in 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: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:This shader does not exist in engine branches after the Orange Box.

Shader Parameters

$corecolortexture <texture>
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.
$corecolortextureframe <texture>
The frame to start an animated $corecolortexture on.
$normalmap <texture>
$dudvmap <texture> (DX8)
The pattern of refraction is defined by a normal map (DX9+) or DUDV map (DX8-). May be animated.
$bumpframe <int>
The frame to start an animated bumpmap on. To do: This may not work with the proxy required for the effect.
$bumptransform <matrix>
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 X axis.
  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.
Note:All values must be included!
Bug: Scaling the texture may cause odd issues where the Texture Lock tool in Hammer will not actually lock the texture in place.
Bug: 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.
$envmap <texture>
Adds a cubemap reflection on top of the refraction.
Note:Specular reflections will be drawn even if mat_specular is set to 0
$envmapframe <int>
The frame to start an animated cubemap on.
$envmaptint <RGB matrix>
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:You must use quotemarks, as there are space characters within the value.
$envmapcontrast <normal>
Controls the contrast of the reflection. 0 is natural contrast, while 1 is the full squaring of the color (i.e. color*color).
$envmapsaturation <normal>
Controls the colour saturation of the reflection. 0 is greyscale, while 1 is natural saturation.
$refractamount <float>
Controls the strength of the refraction by multiplying the normal map intensity.
$refracttint <RGB matrix>
Tints the color of the refraction.
$flowmap <texture>
Flowmap to scroll the normal map, which affects the refraction.
$flowmapframe <int>
The frame to start an animated flowmap on.
$flowmapscrollrate <vector2>
The rate at which the normal map scrolls along the flowmap.
$flowmaptexcoordoffset <float>
To do: 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
		}
	}
}