Ru/$envmap: Difference between revisions
Churkinator (talk | contribs) |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 79: | Line 79: | ||
<span id="$envmapmask"></span> | <span id="$envmapmask"></span> | ||
{{ | {{MatParamDef|$envmapmask|texture|Смотреть {{ent|$envmapmask}}. Текстура, которая по-{{L|texel|тексельно}} определяет яркость зеркального отражения.}} | ||
<span id="$envmaptint"></span> | <span id="$envmaptint"></span> | ||
{{ | {{MatParamDef|$envmaptint|RGB matrix|Контролирует яркость отражения {{L|RGB|красного, зелёного и синего}} канала. Использоваться может любое положительное число. По умолчанию: <code>"[1 1 1]"</code>, что означает 100% яркость. | ||
{{important| '''На {{ent|VertexLitGeneric}} этот параметр конвертируется из гамма в линейное пространство'''. Вводимые значения преобразуются в {{code|X^2.2f}}. Например, 0.25 равно не 25% отражения, а ~5%! }} | {{important| '''На {{ent|VertexLitGeneric}} этот параметр конвертируется из гамма в линейное пространство'''. Вводимые значения преобразуются в {{code|X^2.2f}}. Например, 0.25 равно не 25% отражения, а ~5%! }} | ||
{{note|Вы ''обязаны'' использовать кавычки, так как внутри значения есть пробелы.}} | {{note|Вы ''обязаны'' использовать кавычки, так как внутри значения есть пробелы.}} | ||
Line 87: | Line 87: | ||
{{tip|Этот параметр часто используется для того, чтобы приглушить яркость зеркального отражения без использования выше описанной <code>$envmapmask</code>.}}}} | {{tip|Этот параметр часто используется для того, чтобы приглушить яркость зеркального отражения без использования выше описанной <code>$envmapmask</code>.}}}} | ||
<span id="$envmapcontrast"></span> | <span id="$envmapcontrast"></span> | ||
{{ | {{MatParamDef|$envmapcontrast|normal|Контролирует [[Wikipedia:Contrast (vision)|контраст]] отражения. 0 - натуральный контраст, а 1 возводит цвет в квадратную степень (т.е. цвет*цвет). | ||
: {{note|Не работает при включённом {{L|$phong}}.}} | : {{note|Не работает при включённом {{L|$phong}}.}} | ||
: {{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".}}}} | ||
<span id="$envmapsaturation"></span> | <span id="$envmapsaturation"></span> | ||
{{ | {{MatParamDef|$envmapsaturation|RGB matrix|Контролирует цветовую насыщенность отражения. 0 - серые тона, а 1 - натуральный цвет. Красный, Зелёный и Синий цвета можно изменять используя <code>"[к з с]" </code> соответственно. | ||
: {{note|In the Shadercode for {{src13|2}} and {{as|2}} the parameter is defined as a float parameter. However it will be used as a vec3 and the Shader expects and uses it as such.}} | : {{note|In the Shadercode for {{src13|2}} and {{as|2}} the parameter is defined as a float parameter. However it will be used as a vec3 and the Shader expects and uses it as such.}} | ||
: {{note|Не работает при включённом на моделях {{L|$phong}}.}} | : {{note|Не работает при включённом на моделях {{L|$phong}}.}} | ||
: {{bug|{{css}} Работает только на моделях.{{modernConfirm|Эта ошибка существует в других {{src13mp}} играх использующие обычные затенения? (кроме: {{hl2dm}} {{hldms}} {{dods}} {{tf2}}) }} }} }} | : {{bug|{{css}} Работает только на моделях.{{modernConfirm|Эта ошибка существует в других {{src13mp}} играх использующие обычные затенения? (кроме: {{hl2dm}} {{hldms}} {{dods}} {{tf2}}) }} }} }} | ||
<span id="$envmapframe"></span> | <span id="$envmapframe"></span> | ||
{{ | {{MatParamDef|$envmapframe|int|The frame to start an animated cubemap on.}} | ||
<span id="$envmapmode"></span> | <span id="$envmapmode"></span> | ||
{{ | {{MatParamDef|$envmapmode|int|Depreciated MATERIAL_VAR_ENVMAPMODE {{=}} (1 << 25), // OBSOLETE|deprecated=1}} | ||
<span id="$basetexturenoenvmap"></span> | <span id="$basetexturenoenvmap"></span> | ||
{{ | {{MatParamDef|$basetexturenoenvmap|and=$basetexture2noenvmap|bool|Used for materials with two {{L|albedo}}s, to make one or the other matte. See also {{ent|$basetexture}} and {{ent|$basetexture2}}. | ||
:{{note|Superseded in {{csgo}} by <code>[[$envmapmask#CS:GO_WorldVertexTransition_Parameters|$envmapmask2]].</code>}}|dx9=1|shaders=WorldVertexTransition|removed={{csgo}}}} | :{{note|Superseded in {{csgo}} by <code>[[$envmapmask#CS:GO_WorldVertexTransition_Parameters|$envmapmask2]].</code>}}|dx9=1|shaders=WorldVertexTransition|removed={{csgo}}}} | ||
<span id="$envmapoptional"></span> | <span id="$envmapoptional"></span> | ||
{{ | {{MatParamDef|$envmapoptional|choices|Sets the oldest {{L|DirectX Versions|DirectX version}} that should draw the reflection. Choose from: | ||
:*<code>80</code> (DirectX 8) | :*<code>80</code> (DirectX 8) | ||
:*<code>81</code> (DirectX 8.1) | :*<code>81</code> (DirectX 8.1) | ||
Line 109: | Line 109: | ||
:*<code>95</code> (DirectX 9 with Shader Model 3)|removed={{l4d}}}} | :*<code>95</code> (DirectX 9 with Shader Model 3)|removed={{l4d}}}} | ||
<span id="$envmapsphere"></span> | <span id="$envmapsphere"></span> | ||
{{ | {{MatParamDef|$envmapsphere|bool|Determines whether the material's envmap should be a spheremap (using matcap shading like {{gldsrc}} {{L|MDL (GoldSrc)|"chrome"}} textures) instead of a cubemap. Set this to 1 to use a spheremap. | ||
: {{bug|In {{L|DirectX Versions|DirectX 9}} mode, this will instead act like a regular cubemap with all 6 faces being identical.}}|deprecated=1|removed={{as}}|also={{gmod}}}} | : {{bug|In {{L|DirectX Versions|DirectX 9}} mode, this will instead act like a regular cubemap with all 6 faces being identical.}}|deprecated=1|removed={{as}}|also={{gmod}}}} | ||
<span id="$noenvmapmip"></span> | <span id="$noenvmapmip"></span> | ||
{{ | {{MatParamDef|$noenvmapmip|bool|Only use the top-level mipmap of the cubemap.|only={{csgo}}|shaders=LightmappedGeneric}} | ||
[[File:Reflection tinting example.png|thumb|200px|Вентиляция без и с оттенком отражения. В нижней части изображения перечислены параметры использованные для создания этого эффекта.]] | [[File:Reflection tinting example.png|thumb|200px|Вентиляция без и с оттенком отражения. В нижней части изображения перечислены параметры использованные для создания этого эффекта.]] | ||
<span id="$fresnelreflection"></span> | <span id="$fresnelreflection"></span> | ||
{{ | {{MatParamDef|$fresnelreflection|float|Добавляет [http://www.3drender.com/glossary/fresneleffect.htm эффект Френеля] отражению. 0 - нет эффекта, а 1 - накладывает полный эффект, схож с <code>{{L|Water_(shader)|Water}}</code>. Эффект умножается при значениях выше 1. | ||
{{bug|Значения инвертированы в {{bms}}, 0 - накладывает полный эффект, а 1 - нет эффекта.}}|since={{src06}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}} | {{bug|Значения инвертированы в {{bms}}, 0 - накладывает полный эффект, а 1 - нет эффекта.}}|since={{src06}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}} | ||
<span id="$envmapfresnel"></span> | <span id="$envmapfresnel"></span> | ||
{{ | {{MatParamDef|$envmapfresnel|float|Тоже самое что и <code>$fresnelreflection</code>, но для <code>VertexLitGeneric</code>. По умолчанию будет использовать диапазон установленный <code>$phongfresnelranges</code>. | ||
: {{note|Работает только если сначала был включён {{L|$phong}} {{l4d}}.}} | : {{note|Работает только если сначала был включён {{L|$phong}} {{l4d}}.}} | ||
|since={{src07}}|dx9=1|shaders=VertexLitGeneric}} | |since={{src07}}|dx9=1|shaders=VertexLitGeneric}} | ||
[[File:Anisotropic reflection example.jpeg|thumb|200px|Пример анизотропных отражений в игре с включённым $envmapanisotropyscale.]] | [[File:Anisotropic reflection example.jpeg|thumb|200px|Пример анизотропных отражений в игре с включённым $envmapanisotropyscale.]] | ||
<span id="$envmapfresnelminmaxexp"></span> | <span id="$envmapfresnelminmaxexp"></span> | ||
{{ | {{MatParamDef|$envmapfresnelminmaxexp|vector|Устанавливает диапазон френеля для материалов, использующих <code>$envmapfresnel</code> без фонга. По умолчанию: <code>"[0 1 2]"</code>. | ||
: {{Note|Значения френеля для этого параметра отличаются от <code>{{L|$phong|$phongfresnelranges}}</code>. Первое значение - минимальное количество френеля, второе значение - максимальное количество френеля, а третье значение - экспонента.}} | : {{Note|Значения френеля для этого параметра отличаются от <code>{{L|$phong|$phongfresnelranges}}</code>. Первое значение - минимальное количество френеля, второе значение - максимальное количество френеля, а третье значение - экспонента.}} | ||
: {{bug|Не может быть использован вместе с {{ent|$bumpmap}}. Вместо этого используйте <code>$phongfresnelranges</code>.}}|since={{l4d}}|shaders=VertexLitGeneric}} | : {{bug|Не может быть использован вместе с {{ent|$bumpmap}}. Вместо этого используйте <code>$phongfresnelranges</code>.}}|since={{l4d}}|shaders=VertexLitGeneric}} | ||
<span id="$envmaplightscale"></span> | <span id="$envmaplightscale"></span> | ||
{{ | {{MatParamDef|$envmaplightscale|float|Tint the surface's specular reflection with its lightmap. This matches a surface's reflection with its diffuse lighting and acts as rudimentary reflection occlusion. With a value of 1, a surface will have no reflection if it isn't lit at all. For models in {{csgo}}, vertex lighting is used for the tinting instead of a lightmap.{{note|Values above 1 for this parameter are technically permitted, but start inverting the effect.}}|since={{as}}|also={{gmod}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend {{csgo}}, VertexLitGeneric {{csgo}}, WorldVertexTransition {{csgo}}}} | ||
<span id="$envmaplightscaleminmax"></span> | <span id="$envmaplightscaleminmax"></span> | ||
{{ | {{MatParamDef|$envmaplightscaleminmax|vector2|Thresholds for the lightmap reflection tinting effect. Setting the minimum value higher increases the minimum light amount at which the reflection gets nerfed to nothing.|only={{csgo}}|also={{gmod}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, VertexLitGeneric, WorldVertexTransition}} | ||
<span id="$envmapanisotropy"></span> | <span id="$envmapanisotropy"></span> | ||
{{ | {{MatParamDef|$envmapanisotropy|bool|Enables anisotropic reflection emulation by warping the reflection downwards.<br> | ||
For this it uses the alpha channel of the {{ent|$bumpmap}}.<br> | For this it uses the alpha channel of the {{ent|$bumpmap}}.<br> | ||
It linearly interpolates between a normal reflection vector and an anisotropic one.<br> | It linearly interpolates between a normal reflection vector and an anisotropic one.<br> | ||
This means that values of 0 in the alpha will result in normal reflections, and a value of 1 will result in anisotropic reflections. {{bug|Does not work with {{ent|$normalmapalphaenvmapmask}}}} {{bug|Does not work with {{ent|$basealphaenvmapmask}} except {{ent|Lightmapped_4WayBlend}}}} {{note|Requires a {{ent|$bumpmap}} to be present.}}|only={{csgo}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}} | This means that values of 0 in the alpha will result in normal reflections, and a value of 1 will result in anisotropic reflections. {{bug|Does not work with {{ent|$normalmapalphaenvmapmask}}}} {{bug|Does not work with {{ent|$basealphaenvmapmask}} except {{ent|Lightmapped_4WayBlend}}}} {{note|Requires a {{ent|$bumpmap}} to be present.}}|only={{csgo}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}} | ||
<span id="$envmapanisotropyscale"></span> | <span id="$envmapanisotropyscale"></span> | ||
{{ | {{MatParamDef|$envmapanisotropyscale|normal| Multiplier for how much the reflection should be warped.|only={{csgo}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}} | ||
== Консольные команды == | == Консольные команды == | ||
{{Varcom|start}} | |||
{{ | {{Varcom|buildcubemaps|||Generates cubemaps for use in materials. If this isn't run, objects will reflect the skybox (OB) or have an invalid reflection, white in Ep1 and pink checkerboards in MP.}} | ||
{{ | {{Varcom|envmap|||Generates an environment map at the player's position and dumps it in cubemap_screenshots/, in six separate PFM files (or, if running without HDR, TGA files). | ||
{{Tip|Cubemaps created this way will capture dynamic entities and models in them, which are normally hidden when using <code>buildcubemaps</code>.}}}} | |||
{{ | {{Varcom|mat_envmaptgasize|32|int|Устанавливает разрешение для файлов созданных с помощью <code>envmap</code>.}} | ||
{{ | {{Varcom|mat_fastspecular||01|Quickly disable or enable specular rendering without reloading materials. This does not affect performance, only appearance. <code>mat_specular</code> must be used for proper performance testing. | ||
{{Bug|Не работает в некоторых играх.}} | |||
{{Note|Despite common misconception, setting this to 0 does ''not'' enable a "fancy specular" mode, it simply disables specular rendering entirely.}}}} | |||
{{ | {{Varcom|mat_specular|1|01|Отключает или включает зеркальные отражения, выгружает или загружает зеркальные материалы из памяти.}} | ||
{{ | {{Varcom|r_showenvcubemap||bool|Команда для отображения всех карт-кубов на всех динамических объектах в полную яркость. Использовалось для создания изображения в начале статьи.}} | ||
{{Varcom|end}} | |||
== Смотреть также == | == Смотреть также == |
Latest revision as of 12:07, 23 August 2025
$envmap
- это материальный параметр шейдера , доступно для всех игр на движке Source.

You can help by updating the translation.
Also, please make sure the article complies with the alternate languages guide.
It most commonly used to approximate the specular reflections seen on smooth surfaces, such as metals, glass and plastics. This is achieved by mapping the vertex normals of a model to positions on a cubemap - specified by $envmap
- and adding the sampled color from the cubemap to the model's surface. Typically, the cubemap is a simple, static "environment map" which has been pre-rendered (although a custom cubemap can be animated).
When $envmap
is set to env_cubemap
and buildcubemaps has been run on the map, the engine will automatically select the environment map contained in the BSP which is nearest to the model as it moves through the world, providing a very rough approximation of dynamic reflections.
The other form of specularity supported by Source is the Phong type, which provides simpler reflections on both static and dynamic models.
Доступность
$envmap
был представлен в Source в
и
. Также доступен во всех поздних играх.


Синтаксис
$envmap env_cubemap
"env_cubemap" is typically used, which tells VBSP to swap in the name of the nearest env_cubemap
when the map compiles. However, it is also possible to use a static cubemap image that has been manually created.

$envmap
используется без указания $basetexture, то даже в таком случае зеркальные отражения будут отображены.

Создание пользовательской текстуры карты-куба
Creating a custom cubemap texture might be required for some circumstances and is used occasionally in some Valve models.




В VTFEdit
For this to work you will need to have the 6 sides of the cubemap saved as individual textures in the correct orientation for it to appear correctly in the Source Engine. So some faces might need to be rotated either clockwise or counter clockwise. Each face will need to be mirrored horizontally before orientation.


$envmapsphere
parameter. VTFEdit can generate this face automatically, via the "Advanced" tab when importing.To the right hand side of this page you will find two guide images to aid in properly rotating each side of your environment render.
Save one or both of those guides on your computer and then import your environment render onto it or recreate it in a smaller scale, then rotate your sides as instructed by the images.
Save every side as a separate image file, their names should be the number found on that specific square. This will ensure that the environment texture will be built correctly, as the numbers also represent the import order in VTFEdit .
Once you have all the image sides ready you can just import them all into VTFEdit and select "Environment Map". Texture format is up to you, generally DXT1 will do.
Enable the "Clamp S" and "Clamp T" texture flags.
Then just save it all as a .vtf file and use it in your VMT like so:
"$Envmap" "effects/my_cubemap"
"effects" is the usual folder for environments/cubemaps You may put yours anywhere you like
В 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.
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 // read .pfm file instead of .tga
pfmscale 1 // higher values will result in a brighter sky
nocompress 1 // disable compression (HDR compression is only supported by skyboxes)
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.
Параметры и Эффекты
"[1 1 1]"
, что означает 100% яркость.




$envmapmask
.
"[к з с]"
соответственно.
Примечание:In the Shadercode for
Source 2013 and
Alien Swarm the parameter is defined as a float parameter. However it will be used as a vec3 and the Shader expects and uses it as such.
Примечание:Не работает при включённом на моделях $phong .
Баг:
Работает только на моделях. [нужно проверить в ?]
Примечание:Superseded in
by
$envmapmask2.

80
(DirectX 8)81
(DirectX 8.1)90
(DirectX 9)95
(DirectX 9 with Shader Model 3)
Water
. Эффект умножается при значениях выше 1.


$fresnelreflection
, но для VertexLitGeneric
. По умолчанию будет использовать диапазон установленный $phongfresnelranges
.
Примечание:Работает только если сначала был включён $phong
.
$envmapfresnel
без фонга. По умолчанию: "[0 1 2]"
.
Примечание:Значения френеля для этого параметра отличаются от
$phongfresnelranges
. Первое значение - минимальное количество френеля, второе значение - максимальное количество френеля, а третье значение - экспонента.


For this it uses the alpha channel of the $bumpmap.
It linearly interpolates between a normal reflection vector and an anisotropic one.



Консольные команды
Cvar/Command | Parameters or default value | Descriptor | Effect |
---|---|---|---|
buildcubemaps | Generates cubemaps for use in materials. If this isn't run, objects will reflect the skybox (OB) or have an invalid reflection, white in Ep1 and pink checkerboards in MP. | ||
envmap | Generates an environment map at the player's position and dumps it in cubemap_screenshots/, in six separate PFM files (or, if running without HDR, TGA files).
![]() buildcubemaps . |
||
mat_envmaptgasize | 32 | int | Устанавливает разрешение для файлов созданных с помощью envmap . |
mat_fastspecular | 0 disables, 1 enables | Quickly disable or enable specular rendering without reloading materials. This does not affect performance, only appearance. mat_specular must be used for proper performance testing.
![]() ![]() |
|
mat_specular | 1 | 0 disables, 1 enables | Отключает или включает зеркальные отражения, выгружает или загружает зеркальные материалы из памяти. |
r_showenvcubemap | bool | Команда для отображения всех карт-кубов на всех динамических объектах в полную яркость. Использовалось для создания изображения в начале статьи. |
Смотреть также
- $envmapmask (маска зеркального отражения)
- $phong (для рассеянного отражения)
- Cubemap