这篇条目有关 Source引擎。如需详情,点击这里。

Zh/$envmapmask: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(Created page with "{{subst:#if: Translation of '$envmapmask' to '中文' via Template:LanguageBar buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * *...")
 
No edit summary
Line 1: Line 1:
{{subst:#if:|||{{LAuto/t}}
{{wip}}{{translating}}
 
--- DON'T JUST BLINDLY DELETE THIS PART. DO REPLACE THE LINKS AND CATEGORIES. THE PICTURE SHOWS HOW TO USE IT ! ---
 
SEARCH FOR:
\[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]
 
REPLACE WITH:
{{subst:LAuto|$1$2}}
 
}}{{wip}}{{translating}}
{{LanguageBar}}
{{LanguageBar}}


Line 18: Line 8:
{{warning|<code>$envmapmask</code> will not work with materials using {{ent|$bumpmap}}/ in most situations; see [[#Alternative_methods]].
{{warning|<code>$envmapmask</code> will not work with materials using {{ent|$bumpmap}}/ in most situations; see [[#Alternative_methods]].
{{note|Exceptions:
{{note|Exceptions:
* '''[[LightmappedReflective]]''' (uses {{ent|$normalmap}})
* '''{{L|LightmappedReflective}}''' (uses {{ent|$normalmap}})
* {{mapbase|only}} '''[[VertexLitGeneric]]'''
* {{mapbase|only}} '''{{L|VertexLitGeneric}}'''
* {{csgo|only}}'''[[LightmappedGeneric]]'''
* {{csgo|only}}'''{{L|LightmappedGeneric}}'''
}} }}
}} }}
{{warning|<code>$envmapmask</code> will not work with materials using {{ent|$phong}}, at all. By default it will use the $basetexture's alpha channel for masking the envmap.}}
{{warning|<code>$envmapmask</code> will not work with materials using {{ent|$phong}}, at all. By default it will use the $basetexture's alpha channel for masking the envmap.}}
Line 29: Line 19:
  $envmapmask <texture>
  $envmapmask <texture>


  [[VertexLitGeneric]]
  {{L|VertexLitGeneric}}
  {
  {
  [[$envmap]] env_cubemap
  {{L|$envmap}} env_cubemap
  '''$envmapmask "props/tvscreen_test"'''
  '''$envmapmask "props/tvscreen_test"'''
  }
  }
Line 37: Line 27:
==Additional parameters==
==Additional parameters==


[[File:Scanner mask.jpg|thumb|250px|[[npc_cscanner]]'s mask.]]
[[File:Scanner mask.jpg|thumb|250px|{{L|npc_cscanner}}'s mask.]]


{{MatParam|$envmapmasktransform|matrix|
{{MatParam|$envmapmasktransform|matrix|
Line 52: Line 42:
==Alternative methods==
==Alternative methods==


Rather than creating a whole new texture for a specular mask, you can embed one into the [[alpha channel]] of the {{ent|$basetexture}} or {{code|$bumpmap}}. Model materials with {{code|$bumpmap}} '''must''' do this. Unfortunately, it ''won't'' reduce memory usage.
Rather than creating a whole new texture for a specular mask, you can embed one into the {{L|alpha channel}} of the {{ent|$basetexture}} or {{code|$bumpmap}}. Model materials with {{code|$bumpmap}} '''must''' do this. Unfortunately, it ''won't'' reduce memory usage.


If you do use these commands, transformations and other such parameters applied to {{code|$basetexture / $bumpmap}} will also apply to the specular mask.
If you do use these commands, transformations and other such parameters applied to {{code|$basetexture / $bumpmap}} will also apply to the specular mask.
Line 61: Line 51:
* The alpha channel '''''is not''''' inverted in {{src07|2}} ''and'' {{csgo|2}} for models, but the alpha channel '''''is''''' inverted for brushes!
* The alpha channel '''''is not''''' inverted in {{src07|2}} ''and'' {{csgo|2}} for models, but the alpha channel '''''is''''' inverted for brushes!
:* In {{src13}}, the alpha channel is only inverted for models if {{cmd|$phong}} is disabled!
:* In {{src13}}, the alpha channel is only inverted for models if {{cmd|$phong}} is disabled!
* {{l4d2}} auto enables if '''$envmap''' is present. Opaque areas are reflective while transparent are matte. Set as [[bool|true]] to invert {{code|$basetexture}} alpha channel behaviour. This allow {{code|[[$bumpmap]]}} have a dedicated {{code|[[$phong]]}} mask, when material transparency is not needed.}}
* {{l4d2}} auto enables if '''$envmap''' is present. Opaque areas are reflective while transparent are matte. Set as {{L|bool|true}} to invert {{code|$basetexture}} alpha channel behaviour. This allow {{code|{{L|$bumpmap}}}} have a dedicated {{code|{{L|$phong}}}} mask, when material transparency is not needed.}}
{{bug|<ul>
{{bug|<ul>
<li> In CSGO, this parameter breaks materials using {{ent|$translucent}}. Use {{code|$envmapmask}} or {{code|$normalmapalphaenvmapmask}} instead.<br>
<li> In CSGO, this parameter breaks materials using {{ent|$translucent}}. Use {{code|$envmapmask}} or {{code|$normalmapalphaenvmapmask}} instead.<br>
<li> In all of: {{gmod}}{{src13}}{{tf2}}{{as}}{{csgo}} on {{ent|VertexLitGeneric}} ('''Without''' {{ent|$phong}}), {{ent|WorldVertexTransition}} and {{ent|LightmappedGeneric}}, <code>$basealphaenvmapmask</code> cannot be used with {{ent|$bumpmap}}.<br>
<li> In all of: {{gmod}}{{src13}}{{tf2}}{{as}}{{csgo}} on {{ent|VertexLitGeneric}} ('''Without''' {{ent|$phong}}), {{ent|WorldVertexTransition}} and {{ent|LightmappedGeneric}}, <code>$basealphaenvmapmask</code> cannot be used with {{ent|$bumpmap}}.<br>
<li> In all of: {{gmod}}{{src13}}{{tf2}}{{as}}{{csgo}} on {{ent|LightmappedGeneric}} and {{ent|WorldVertexTransition}}, <code>$basealphaenvmapmask</code> cannot be used with {{ent|$selfillum}}, {{ent|$seamless_detail}} or {{ent|$distancealpha}}.<br>
<li> In all of: {{gmod}}{{src13}}{{tf2}}{{as}}{{csgo}} on {{ent|LightmappedGeneric}} and {{ent|WorldVertexTransition}}, <code>$basealphaenvmapmask</code> cannot be used with {{ent|$selfillum}}, {{ent|$seamless_detail}} or {{ent|$distancealpha}}.<br>
<li> In {{csgo}}, on {{ent|LightmappedGeneric}} and {{ent|WorldVertexTransition}}, <code>$basealphaenvmapmask</code> cannot be used with [[$detail#Parameters and Effects|$detailblendmode]] "9" or {{ent|$envmapanisotropy}}.<br>
<li> In {{csgo}}, on {{ent|LightmappedGeneric}} and {{ent|WorldVertexTransition}}, <code>$basealphaenvmapmask</code> cannot be used with {{L|$detail#Parameters and Effects|$detailblendmode}} "9" or {{ent|$envmapanisotropy}}.<br>
<li> In {{csgo}}, on {{ent|Lightmapped_4WayBlend}}, <code>$basealphaenvmapmask</code> cannot be used with {{ent|$selfillum}}.
<li> In {{csgo}}, on {{ent|Lightmapped_4WayBlend}}, <code>$basealphaenvmapmask</code> cannot be used with {{ent|$selfillum}}.
<li> This cannot be used with {{ent|$bumpmap}} on {{ent|LightmappedGeneric}}
<li> This cannot be used with {{ent|$bumpmap}} on {{ent|LightmappedGeneric}}
Line 72: Line 62:


<br>{{MatParam|$normalmapalphaenvmapmask|bool|Use the alpha channel of the {{code|$bumpmap}} or {{code|$normalmap}} as the specular mask.
<br>{{MatParam|$normalmapalphaenvmapmask|bool|Use the alpha channel of the {{code|$bumpmap}} or {{code|$normalmap}} as the specular mask.
{{warning|Using this in combination with {{code|[[$phong|$basemapalphaphongmask]]}} or {{code|[[$phong|$basemapluminancephongmask]]}} will set the mask used for the {{ent|$envmap}} to be those instead. <br>
{{warning|Using this in combination with {{code|{{L|$phong|$basemapalphaphongmask}}}} or {{code|{{L|$phong|$basemapluminancephongmask}}}} will set the mask used for the {{ent|$envmap}} to be those instead. <br>
'''There are additional caveats''' when using {{ent|$phong}}. See its entry for more information about possible issues.}}
'''There are additional caveats''' when using {{ent|$phong}}. See its entry for more information about possible issues.}}
}}
}}
{{bug|
{{bug|
* In all of: {{gmod}}{{src13}}{{tf2}}{{as}}{{csgo}} on {{ent|VertexLitGeneric}} ('''Without''' {{ent|$phong}}), <code>$normalmapalphaenvmapmask</code> cannot be used with [[Glowing_Textures#.24selfillum|$selfillumfresnel]].<br>
* In all of: {{gmod}}{{src13}}{{tf2}}{{as}}{{csgo}} on {{ent|VertexLitGeneric}} ('''Without''' {{ent|$phong}}), <code>$normalmapalphaenvmapmask</code> cannot be used with {{L|Glowing_Textures#.24selfillum|$selfillumfresnel}}.<br>
:{{note| Using <code>$normalmapalphaenvmapmask</code> with {{ent|$phong}} and [[Glowing_Textures#.24selfillum|$selfillumfresnel]] has special caveats that should be considered. Check {{ent|$phong}} for  for more information.}}
:{{note| Using <code>$normalmapalphaenvmapmask</code> with {{ent|$phong}} and {{L|Glowing_Textures#.24selfillum|$selfillumfresnel}} has special caveats that should be considered. Check {{ent|$phong}} for  for more information.}}
* In {{csgo}}, on {{ent|LightmappedGeneric}} and {{ent|WorldVertexTransition}}, {{code|[[$normalmapalphaenvmapmask]]}} cannot be used with [[$detail#Parameters and Effects|$detailblendmode]] "9" or {{ent|$envmapanisotropy}}.}}<br>
* In {{csgo}}, on {{ent|LightmappedGeneric}} and {{ent|WorldVertexTransition}}, {{code|{{L|$normalmapalphaenvmapmask}}}} cannot be used with {{L|$detail#Parameters and Effects|$detailblendmode}} "9" or {{ent|$envmapanisotropy}}.}}<br>
<br>{{MatParam|$selfillum_envmapmask_alpha|float|Use the alpha channel of the {{code|$envmapmask}} as the {{ent|$selfillum}} mask instead of {{code|$basetexture}}'s alpha.<br>
<br>{{MatParam|$selfillum_envmapmask_alpha|float|Use the alpha channel of the {{code|$envmapmask}} as the {{ent|$selfillum}} mask instead of {{code|$basetexture}}'s alpha.<br>
: {{bug|This Parameter replaces {{code|$selfillum}}. If both are used it will result in an error. The material will not render.}}
: {{bug|This Parameter replaces {{code|$selfillum}}. If both are used it will result in an error. The material will not render.}}
Line 92: Line 82:


==See also==
==See also==
* [[$basetexture]]
* {{L|$basetexture}}
* [[$envmap]] (environment map)  
* {{L|$envmap}} (environment map)  
* [[$phong]] (diffuse reflection)
* {{L|$phong}} (diffuse reflection)
* [[$selfillum ]]
* {{L|$selfillum }}
[[Category:Shader parameters|e]]
{{ACategory|Shader parameters|e}}
[[Category:VMT Reflections]]
{{ACategory|VMT Reflections}}

Revision as of 20:50, 7 August 2025

Under construction.png
This page is actively undergoing a major edit.
As a courtesy, please do not edit this while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.

The person who added this notice will be listed in its edit history should you wish to contact them.

Info content.png
This page is being translated.
You can help by finishing the translation.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)
English (en)Français (fr)Русский (ru)中文 (zh)Translate (Translate)

$envmapmask是一个材质(en)着色器(en)参数,可在所有的 起源 起源 游戏中使用。 It defines a specular mask which affects how strongly each pixel of a material reflects light from the $envmap. The mask should be a grayscale image in which entirely reflective areas are white and entirely matte areas are black. For diffuse type specularity which does not rely on $envmap, see $phong.

Icon-Bug.png错误:In 起源2007 起源2007 games, using an $envmapmask which is not stored in a subfolder will cause the texture to fail loading in-game.
Warning.png警告:$envmapmask will not work with materials using $bumpmap/ in most situations; see #Alternative_methods.
Note.png注意:Exceptions:
Warning.png警告:$envmapmask will not work with materials using $phong, at all. By default it will use the $basetexture's alpha channel for masking the envmap.
Note.png注意:While specular masks are traditionally greyscale, they can be colored. In such an instance, the color data will act as a per-texel $envmaptint.

VMT syntax example

$envmapmask <texture>
VertexLitGeneric(en)
{
	$envmap(en)			env_cubemap
	$envmapmask		"props/tvscreen_test"
}

Additional parameters

npc_cscanner(en)'s mask.

$envmapmasktransform $envmapmaskscale $envmapmaskframe

CS:GO WorldVertexTransition Parameters

$envmapmask2 $envmapmasktransform2 $envmapframe2

Alternative methods

Rather than creating a whole new texture for a specular mask, you can embed one into the alpha channel(en) of the $basetexture or $bumpmap. Model materials with $bumpmap must do this. Unfortunately, it won't reduce memory usage.

If you do use these commands, transformations and other such parameters applied to $basetexture / $bumpmap will also apply to the specular mask.

$basealphaenvmapmask

Note.png注意:
  • Alpha channels embedded in $basetexture work in reverse. Transparent areas are reflective, opaque areas are matte. This is because, say, a window texture's alpha mask would be mostly black to allow for transparency -- yet that black part of the mask would also be the most reflective part. To avoid having to duplicate a texture file simply to invert the alpha mask, you can use this material parameter instead.
  • The alpha channel is not inverted in 起源2007 起源2007 and 反恐精英:全球攻势 反恐精英:全球攻势 for models, but the alpha channel is inverted for brushes!
  • In 起源2013, the alpha channel is only inverted for models if $phong is disabled!
  • 求生之路2 auto enables if $envmap is present. Opaque areas are reflective while transparent are matte. Set as true(en) to invert $basetexture alpha channel behaviour. This allow $bumpmap(en) have a dedicated $phong(en) mask, when material transparency is not needed.
Icon-Bug.png错误:  [todo tested in ?]


$normalmapalphaenvmapmask

Icon-Bug.png错误:
Note.png注意: Using $normalmapalphaenvmapmask with $phong and $selfillumfresnel(en) has special caveats that should be considered. Check $phong for for more information.



$selfillum_envmapmask_alpha
$envmapmaskintintmasktexture

Merging Specular Level into Normal Alpha in 3ds Max

To merge a Specular Level map into the Normal Map alpha, you can create a Composite Map node with the normal map in Layer 1 and the specular map in Mask 1. Then right-click the composite map, click Render Map and save this new image to file (remembering to keep the Gamma at 1.0 and using 32 bits per pixel in the save options).

These steps are automated in the Alpha Spec tool in Wall Worm 2.72+.

See also