$envmap: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Robot: fixing template case.)
(cleanup)
Line 1: Line 1:
[[Image:Specular.jpg|thumb|right|Specular reflections.]]
[[File:Specular.jpg|thumb|Specular reflections.]]


The $envmap [[VMT]] parameter defines the 'environment map' of a material, normally reflecting the nearest [[env_cubemap]].
The '''<code>$envmap</code>''' [[VMT]] parameter creates [[wikipedia:specular reflection|specular reflection]]s, which are seen on smooth surfaces. It does this by defining an "environment map" (specifically a [[cubemap]]) to draw as a reflection; normally that of the nearest [[env_cubemap]] entity.


This creates 'specular' reflections (seen on smooth surfaces).
The other form of reflection supported by Source is the diffuse [[phong]] type.


== VMT syntax==
== VMT syntax==
Line 9: Line 9:
  $envmap env_cubemap
  $envmap env_cubemap


env_cubemap is normally used, as it tells [[Vbsp|VBSP]] to substitute it for the name of the nearest [[env_cubemap]] entity when the map compiles. However it is also possible to enter the name of a texture directly.
"env_cubemap" is normally used, as it tells [[VBSP]] to swap in the name of the nearest [[env_cubemap]] when the map compiles. However it is also possible to enter the name of a texture directly.


== Additional Parameters ==
== Additional Parameters ==


; <code>$envmapmask <texture></code>
: See <code>[[$envmapmask]]</code>. A [[VTF]] file that determines per-[[texel]] reflection intensity.
; <code>$envmaptint "[<red [[float]]> <green float> <blue float>]"</code>
: Controls the intensity of the reflection's [[RGB|red, green and blue]] color channels. Any positive number can be used. Default is <code>"[1 1 1]"</code>, which means 100% intensity. {{note|You ''must'' use quotemarks, as there are space characters within the value.}} {{tip|This command widely used to dim the brightness of a specular reflection without an <code>$envmapmask</code> texture.}}
; <code>$envmapcontrast <[[normal]]></code>
; <code>$envmapcontrast <[[normal]]></code>
: Controls the [[Wikipedia:Contrast (vision)|contrast]] of the reflection.
: Controls the [[Wikipedia:Contrast (vision)|contrast]] of the reflection. 0 is the normal contrast, while 1 is the full squaring of the color (i.e. color*color).
: 0 is the normal contrast, while 1 is the full squaring of the color (i.e. color*color).
: {{tip|Use higher contrasts to diminish relatively darker areas and increase "hot spots".}}
: {{tip|Use higher contrasts to diminish relatively darker areas and increase "hot spots".}}
; <code>$envmapsaturation <normal></code>
; <code>$envmapsaturation <normal></code>
: Controls the colour saturation of the reflection.
: Controls the colour saturation of the reflection. 0 is greyscale, while 1 is normal saturation.
: 0 is greyscale, while 1 is normal saturation.
; <code>$envmapframe <[[int]]></code>
; <code>$envmapmask <texture></code>
: The frame to start an animated cubemap on.
: Texture which determines reflection intensity. See <code>[[$envmapmask]]</code>.
; <code>$envmapmode <int?></code>
; <code>$envmaptint "[<red float> <green float> <blue float>]"</code>
: Controls the colour tint (red, green and blue channels) of the reflection. Any positive number can be used.
: Default value is <code>"[1 1 1]"</code>. You must use quotemarks.
: {{tip|This command is useful for controlling the brightness of a specular reflection without an <code>[[$envmapmask]]</code>.}}
; <code>$envmapframe <[[integer]]></code>
: The frame to start an animated cubemap on. (Animated cubemaps? Probably a bad idea.)
; <code>$envmapmode <[[int]]?></code>
: {{TODO|?}}
: {{TODO|?}}
; <code>$basetexturenoenvmap <bool></code>
; <code>$basetexturenoenvmap <[[bool]]></code>
; <code>$basetexture2noenvmap <bool></code>
; <code>$basetexture2noenvmap <bool></code>
: Probably used for materials with two [[albedo]]s, to make one or the other matte.
: Probably used for materials with two [[albedo]]s, to make one or the other matte. Require DirectX 9; see also <code>[[$basetexture]]</code> and <code>[[$basetexture2]]</code>.
: Require DirectX 9; see also <code>[[$basetexture]]</code> and <code>[[$basetexture2]]</code>.
;<code>$envmapoptional <choices></code>
;<code>$envmapoptional <choices></code>
: Sets the oldest DirectX version that should draw the reflection. Choose from:
: Sets the oldest DirectX version that should draw the reflection. Choose from:
Line 46: Line 41:
;<code>[[buildcubemaps]]</code>
;<code>[[buildcubemaps]]</code>
:Generates cubemaps for use in materials. If this isn't run, objects will reflect the skybox (OB) or have an invalid, white reflection (Ep1).
:Generates cubemaps for use in materials. If this isn't run, objects will reflect the skybox (OB) or have an invalid, white reflection (Ep1).
:Click for more details and further commands.
;<code>r_showenvcubemap <[[bool]]></code>
;<code>r_showenvcubemap <bool></code>
:Debug command to display cubemaps on all dynamic objects at full intensity. It was used to create the image at the start of this article.
:Debug command to display cubemaps on all dynamic objects at full intensity. It was used to create the image at the start of this article.


== See Also ==
== See Also ==
* [[DirectX Versions]]
 
* Tutorial: [[Cubemap]]s in Level Design.
* Tutorial: [[Reflective Materials]]
* [[$basetexture]]
* [[$envmapmask]] (specular mask)
* [[$envmapmask]] (specular mask)
* [[$phong]] (diffuse reflection)
* [[$phong]] (for diffuse reflection)
* [[$selfillum]]
* [[Cubemap]]


[[Category:List of Shader Parameters|E]]
[[Category:List of Shader Parameters|E]]
[[Category:VMT Reflections]]
[[Category:VMT Reflections]]

Revision as of 05:43, 29 July 2009

Specular reflections.

The $envmap VMT parameter creates specular reflections, which are seen on smooth surfaces. It does this by defining an "environment map" (specifically a cubemap) to draw as a reflection; normally that of the nearest env_cubemap entity.

The other form of reflection supported by Source is the diffuse phong type.

VMT syntax

$envmap env_cubemap

"env_cubemap" is normally used, as it tells VBSP to swap in the name of the nearest env_cubemap when the map compiles. However it is also possible to enter the name of a texture directly.

Additional Parameters

$envmapmask <texture>
See $envmapmask. A VTF file that determines per-texel reflection intensity.
$envmaptint "[<red float> <green float> <blue float>]"
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.
Tip.pngTip:This command widely used to dim the brightness of a specular reflection without an $envmapmask texture.
$envmapcontrast <normal>
Controls the contrast of the reflection. 0 is the normal contrast, while 1 is the full squaring of the color (i.e. color*color).
Tip.pngTip:Use higher contrasts to diminish relatively darker areas and increase "hot spots".
$envmapsaturation <normal>
Controls the colour saturation of the reflection. 0 is greyscale, while 1 is normal saturation.
$envmapframe <int>
The frame to start an animated cubemap on.
$envmapmode <int?>
Todo: ?
$basetexturenoenvmap <bool>
$basetexture2noenvmap <bool>
Probably used for materials with two albedos, to make one or the other matte. Require DirectX 9; see also $basetexture and $basetexture2.
$envmapoptional <choices>
Sets the oldest DirectX version that should draw the reflection. Choose from:
  • 80 (DirectX 8)
  • 81 (DirectX 8.1)
  • 90 (DirectX 9)
  • 95 (DirectX 9 with Shader Model 3)
  • 98 (DirectX 9 with DirectX 10 hardware)

Console commands

buildcubemaps
Generates cubemaps for use in materials. If this isn't run, objects will reflect the skybox (OB) or have an invalid, white reflection (Ep1).
r_showenvcubemap <bool>
Debug command to display cubemaps on all dynamic objects at full intensity. It was used to create the image at the start of this article.

See Also