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

$basetexture

From Valve Developer Community
(Redirected from $basetexture4)
Jump to: navigation, search
English (en)Español (es)Русский (ru)Translate (Translate)

$basetexture is a material shader parameter available in all Source Source games. It typically defines a diffuse texture. It is very rare for a material not to use this parameter and some shaders will load a default texture if it stays undefined.

VMT Syntax

$basetexture	<texture without extension, relative to <game>/materials/>
LightmappedGeneric
{
	$basetexture	"brick/brickwall031b"
}

Additional Parameters

Transforms the texture before use in the material. This does not affect lightmaps on the surface.
Note.pngNote:This will transform other textures such as $detail, $bumpmap and $envmapmask, if their own respective texture transform parameters haven't been set.

Sometimes, it can transform the textures even then. Usually when the Interpolator limit on the Vertex Shader Output is reached.
The Programmers cut down on required Interpolators by forcing textures to use the same UV and thus the same transform parameter.
As a general rule of thumb, base and envmapmask transforms stay separate, bump and detail transforms are prone to merge.

The extent to which this happens, varies drastically with Shader and even Branch of the Engine.
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?]

The frame displayed for a multi-frame texture. This is normally set by the AnimatedTexture or {{TextureToggle}} proxies, but can be set manually.
Warning.pngWarning:The value must be a valid index, or crashes might occur.

$basetexture2

Some shaders (most notably WorldVertexTransition) allow the use of two albedos. The second texture is handled by a mirrored set of commands with '2' in their name:

Icon-Bug.pngBug: $basetexturetransform2 doesn't exist in the DirectX 9 version of WorldVertexTransition, only working with the DX8 shader. In DX9, $basetexture2 will instead move with the original $basetexturetransform in sync with $basetexture. This is the case in Source 2007 Source 2007, Source 2013 Source 2013, and Alien Swarm Alien Swarm. Other games have not been tested.   [todo tested in?]
Cpp-16px.pngCode Fix: Mapbase Mapbase adds support for $basetexturetransform2 in Source 2013. The specific code can be found on its repository in the LightmappedGeneric shader files.

There are further '2' commands applying to various shader effects, which are each documented in their respective articles.

See also