Zh/$envmap: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[File:Specular.jpg|thumb|250px|Specular reflections.]]
[[File:Specular.jpg|thumb|250px|Specular reflections.]]


'''<code>$envmap</code>''' [[VMT]]可以在光滑的表面产生[[wikipedia:specular reflection|镜面反射]].镜面反射由"环境反射" (特别是([[反射球|cubemap]]));反射将由最近的[[env_cubemap]]实体决定.反射不是动态(实时)的!
'''<code>$envmap</code>''' [[VMT]]可以在光滑的表面产生[[wikipedia:specular reflection|镜面反射]].镜面反射由"环境反射" (特别是([[cubemap|反射球]]));反射将由最近的[[env_cubemap]]实体决定.反射不是动态(实时)的!


另一种引擎支持的反射为[[$phong|漫反射]].
另一种引擎支持的反射为[[$phong|漫反射]].
Line 73: Line 73:


; <code>$envmapmask <texture></code>
; <code>$envmapmask <texture></code>
: 查阅 <code>[[$envmapmask]]</code>. 一个决定每个[[纹理元素|texel]]反射率的[[VTF]]文件.
: 查阅 <code>[[$envmapmask]]</code>. 一个决定每个[[texel|纹理元素]]反射率的[[VTF]]文件.
; <code>$envmaptint "[<red [[float]]> <green float> <blue float>]"</code>
; <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 is often used to dim the brightness of a specular reflection without the overhead of an <code>$envmapmask</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 is often used to dim the brightness of a specular reflection without the overhead of an <code>$envmapmask</code>.}}

Revision as of 21:45, 12 September 2015

Specular reflections.

$envmap VMT可以在光滑的表面产生镜面反射.镜面反射由"环境反射" (特别是(反射球));反射将由最近的env_cubemap实体决定.反射不是动态(实时)的!

另一种引擎支持的反射为漫反射.

语法/结构

$envmap env_cubemap

"env_cubemap"是一个常用的实体, 当地图编译时,它将通知VBSP选择最近的env_cubemap实体. 你也可以使用一个已被手动渲染好的静态反射图像充当 反射。

Note.png注意:大多数反射材质在作为屏幕覆盖材质或海报喷漆时将不会呈现反射。原因不明。

创建一个自定义静态反射材质

有些时候,在有的模型中或其他情况下都会用到自定义的反射材质,所以要学会如何创建一个自定义反射材质

在VTFLib中的使用方法

为了材质能正常工作,你需要六个面的个体材质,且方向要正确,才可正常在引擎中显示. 所以有些面要正/逆时针旋转. 在定向前每个面都要水平反射.


这里是所需要的方向(若图片无法显示请使用VPN)

注释

  • FT=正面
  • BK=背面
  • RT=右
  • LF-左
  • UP=上
  • DN=下

  • CW = 顺时针
  • CCW = 逆时针

  • 00_00_00 示范. (customcubemap_00_00_00.tga)
  • 00_01_00 示范. (customcubemap_00_01_00.tga)
  • 00_02_00 示范. (customcubemap_00_02_00.tga)

https://dl.dropbox.com/u/10798900/Pictures/tut/orientation_convention_source.png


一旦你准备好了所有方向的图片,你便可以将他们放入VTFEDIT中,并选择"Environmetal Map"

https://dl.dropbox.com/u/10798900/Pictures/tut/cubemap_tut1.jpg

然后将他们保存为.vtf格式,并在你的VMT文件中输入以下:

"$Envmap"             "models/cra0kalo/ct_swat/eyeglint_cubemap"    // Reflection environment map static

In VTEX

VTEX will automatically mirror and orient your faces, you need only to provide correctly named textures. Name each file something like envmap001a*.tga, where * is put BK, FT, LF, RT, UP, or DN. If you took a cubemap screenshot in-game, this step will already by done, but to make them work properly with Vtex.exe you must use HDRShop (but before you need to change textures format to BMP, because HDRShop can only work with that kind of format) and then covert them to PFM files format.

待完善: What axis does each direction relate to?

http://i.imgur.com/pa7lnGk.jpg

Create a text file the same name as your textures (e.g. envmap001a.txt). If building for HDR write in the following, otherwise leave it blank:

pfm 1
pfmscale 1
nocompress 1

Put these files into materialsrc and then just drag-n-drop .txt file into vtex.exe and you should end up with a working cubemap! HDR envmaps will be named like envmap001a.hdr.vtf, and only need to exist to work.

Additional Parameters

$envmapmask <texture>
查阅 $envmapmask. 一个决定每个纹理元素反射率的VTF文件.
$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.png注意:You must use quotemarks, as there are space characters within the value.
Tip.png提示:This command is often used to dim the brightness of a specular reflection without the overhead of an $envmapmask.
$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).
Tip.png提示:Use higher contrasts to diminish relatively darker areas and increase "hot spots".
Note.png注意:Will not work when Phong is enabled.
$envmapsaturation <normal>
Controls the colour saturation of the reflection. 0 is greyscale, while 1 is natural saturation.
Note.png注意:Will not work when Phong is enabled.
$envmapframe <int>
The frame to start an animated cubemap on.
$envmapmode <int?>
Depreciated MATERIAL_VAR_ENVMAPMODE = (1 << 25), // OBSOLETE
$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)
$envmapsphere <bool>
Determines whether the material's envmap should be a spheremap (deprecated) instead of a cubemap. Set this to 1 to use a spheremap.
$envmapfresnel <float> (Left 4 Dead 2 and Source Filmmaker only)
Adds a fresnel effect to the reflection. Surfaces facing the viewer are less reflective than surfaces facing sideways. Dependent on Phong fresnel ranges. Effect becomes multiplied with values higher than 1.0.
待完善: Confirm other engine branches for envmapfresnel.
$envmapanisotropy <bool> Template:CSGO add
$envmapanisotropyscale <float> Template:CSGO add
Warps the reflection, "pushing" the top downward.
$envmaplightmapscale Template:CSGO add
Allows the surface's lightmap to be used as an additional mask on the reflections. A value between 0 and 1 determines the degree to which it is masked; values above 1 are permitted but seem to start actually inverting the effect.

控制台命令

buildcubemaps
为材质创建反射.如何创建失败,则会直接反射天空或显示错误材质,错误在EP1中是白色的,在其他游戏为花格.
r_showenvcubemap <bool>
一个展示所有动态物体在高强度反射下的状态的命令。通常会在物体起点创造一个镜像(?对此句翻译尚有疑问)(It was used to create the image at the start of this article.)

相关信息