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

Zh/$lightwarptexture: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
mNo edit summary
(chatgpt translation)
Line 1: Line 1:
{{LanguageBar}}
{{Source topicon}}
{{Source topicon}}
[[File:Lightwarp snow.jpg|thumb|200px|这项技术首次应用于 {{dods|2}}'的雪地地图之中, 比如Kalt的雪景。]]
[[File:Lightwarp heavy.png|thumb|150px|<code>$lightwarptexture</code> 在 {{tf2|2}}中渲染人物的图解]]
[[File:Lightwarp BW.png|thumb|150px|可以实现色调分离,但照明必须严格控制。]]


{{this is a|shader parameter|name=$lightwarptexture|shader=VertexLitGeneric|since=Source 2006|notitlechange=1|nocat=1|dx=dx95}}它的色调{{L|texel}}取决于它们的亮度。它可以被认为是局部的{{L|color correction|彩色修正}}
[[File:Lightwarp snow.jpg|thumb|200px|该技术首次应用于{{L|Day of Defeat: Source|《反恐精英:起源》}}的雪地图,例如Kalt。]]
[[File:Lightwarp heavy.png|thumb|150px|{{code|$lightwarptexture}}{{L|Team Fortress 2|《军团要塞2》}}独特角色渲染风格的重要元素。]]
[[File:Lightwarp BW.png|thumb|150px|可以实现色调分层,但需要对光照进行严格控制。]]


== 警告 ==
{{this is a|shader parameter|name=$lightwarptexture|shader=VertexLitGeneric|since=Source 2006|notitlechange=1|nocat=1|dx=dx95}} 它根据明暗程度调整[[texel|纹素]]的颜色,可以看作是局部的[[color correction|颜色校正]]。
{{Important|<code>$lightwarptexture</code> 必须指定后所有其他纹理,否则它将覆盖它们。}}
{{Important|<code>$lightwarptexture</code> 在{{Ent|VertexLitGeneric}} 之后需要一个 {{Ent|$bumpmap}}. 如果未指定,则使用默认值! '''就好像是 {{Ent|$bumpmap}} 在VMT!'''}}
{{Warning| 这意味着所有不能工作的参数 {{Ent|$bumpmap}} 同样也不会与 <code>$lightwarptexture</code>合作.}}
:* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 won't work - 5 & 6 will work when {{Ent|$phong}} is used.
:* {{Ent|$envmapmask}} won't work except in {{mapbase|4}}. {{Ent|$selfillum_envmapmask_alpha}} Doesn't work in any branch.
{{Note|Does not work without {{Ent|$phong}} on {{Ent|VertexLitGeneric}} in {{css|2}} '''and''' {{csgobranch|4}}.}}
{{Note|<code>$lightwarptexture</code> does not seem to exist at all for {{Ent|LightmappedGeneric}} in {{csgobranch|4}}.}}


{{Bug|Does not work when using {{Ent|$detail}} '''or''' {{Ent|$bumpmap2}} on both {{Ent|LightmappedGeneric}} and {{Ent|WorldVertexTransition}}.}}
{{Note|同样适用于[[LightmappedGeneric]]、[[WorldVertexTransition]]、[[EyeRefract]]}}
{{Bug|Does not work when using [[Glowing_Textures#.24selfillum|$selfillumfresnel]] without also using {{Ent|$phong}}.}}
{{Bug|Does not work when using {{Ent|$seamless_scale}}.}}
 


== Lightwarp textures ==
== 注意事项 ==
A lightwarp texture is a one-dimensional strip of pixels. Dark texels will be tinted with the colour on the left-hand side, and bright texels with the colour on the right. 50% gray means no tint.
{{Important|{{code|$lightwarptexture}} 必须在所有其他纹理之后指定,否则会覆盖它们。}}
{{Important|确保纹理在VTF中启用钳位模式,否则会渲染错误。为此,请使用“Clamp S”和“Clamp T”[[Texture flags|图像标志]]。}}
{{Important|在 {{Ent|VertexLitGeneric}} 中使用 {{code|$lightwarptexture}} 需要一个 {{Ent|$bumpmap}}。如果未指定,将使用默认的凹凸贴图!默认贴图将使 {{Ent|$bumpmap}} 看起来已在VMT中指定!
{{Warning|这意味着所有与 {{Ent|$bumpmap}} 不兼容的参数也无法与 {{code|$lightwarptexture}} 配合使用。
* [[$detail#Parameters and Effects|$detailblendmode]] 参数5-9将无法正常工作(除非使用 {{Ent|$phong}} 时的5 & 6)。
* {{Ent|$envmapmask}} 在非 {{L|Mapbase|2}} 引擎中无法正常工作。
* {{Ent|$selfillum_envmapmask_alpha}} 在任何分支中均无法正常工作。
}} }}
{{Note|在 {{src13|2}} 和 {{csgobranch|2}} 中,{{code|$lightwarptexture}} 需要与 {{Ent|$phong}} 一起使用,单独无效。}}
{{Note|{{code|$lightwarptexture}} 在 {{Ent|LightmappedGeneric}} 中似乎在 {{csgobranch|2}} 中完全不存在。}}


=== Examples ===
{{Bug|在 {{Ent|LightmappedGeneric}} 和 {{Ent|WorldVertexTransition}} 中同时使用 {{Ent|$detail}} 或 {{Ent|$bumpmap2}} 时无效。}}
; <code>snow_warp</code>:[[File:Warptexture.jpg|border|dod\materials\ground\snow_warp]]
{{Bug|使用 [[Glowing_Textures#.24selfillum|$selfillumfresnel]] 但未启用 {{Ent|$phong}} 时无效。}}
: This is the lightwarp texture used in the {{dods|2}} screen to the right. It is designed to add a subtle bluish tint to darker snow without affecting brighter regions.
{{Bug|与 {{Ent|$seamless_scale}} 一起使用时无效。}}
; <code>pyro_lightwarp</code>:[[File:Pyro lightwarp.png|border|tf\materials\models\player\pyro\pyro_lightwarp]]
: This is applied to all {{tf2|2}} characters, not just the Pyro. It creates the high-contrast shadows with red-tinged terminators typical of the illustrative art the game apes.
; Posterized: [[File:Warp bw.png|border|Custom texture]]
: This custom warp texture creates a posterized "line art" style. Enabling lightwarp alone isn't enough however: ambient lighting must be at 0 to make unlit areas black, and world lighting must become viewer-dependent to ensure that shadows are always cast.
; <code>Cel Shading</code>:[[File:Cel_lightwarp.png|border|Custom texture]]
:Cel shading can make objects look more cartoony by replacing the smooth lighting gradient with sharp steps.


Other possible uses of <code>$lightwarptexture</code> include contrast enhancement, tweaking vertex lighting shadow transitions, highlight softening, and more.
== 光偏移纹理 ==
光偏移纹理是一条一维像素带。暗纹素将被着色为左侧的颜色,亮纹素将被着色为右侧的颜色。50% 灰色表示无颜色偏移。
{{note|光偏移在光照贴图的刷子和置换物上与顶点照明模型上表现略有不同。一个完全 50% 灰色的 {{code|$lightwarptexture}} 在刷子或置换物上看起来像没有光偏移一样,而在没有 [[$phong|phong]] 的模型上会表现为均匀受光(类似于GoldSrc的平面阴影纹理模式)。}}


=== VTF 参数 ===
光偏移纹理应使用未压缩的 BGR888 格式,以避免光照渐变中出现不必要的颜色条纹{{ref|1}},并启用 UV 钳位。


::[[File:Celshadingpreview.png|thumb|320px|left|Cel shading in action.]]
如果使用 {{vtex|4}},请使用以下编译参数:
<pre>
nocompress 1 // 禁用纹理压缩,防止颜色条纹
nomip 1 // 禁用 mipmaps,在此情况下不必要
nolod 1 // 始终使用该纹理的全分辨率版本(由于本身分辨率较低)
clamps 1 // 防止在光照极端条件下颜色混合
clampt 1 // 可选?
stripalphachannel 1 // 如果存在,移除不必要的 alpha 通道
</pre>
 
=== 示例 ===
; {{file|ground/snow_warp|vtf}} ({{dods}}):[[File:Warptexture.jpg|border|dod\materials\ground\snow_warp]]
: 这是上方 {{L|Day of Defeat: Source|《反恐精英:起源》}} 屏幕截图中使用的光偏移纹理。它旨在为较暗的雪区域添加轻微的蓝色调,而不会影响较亮的区域。
; {{file|models/player/pyro/pyro_lightwarp|vtf}} ({{tf2}}):[[File:Pyro lightwarp.png|border|tf\materials\models\player\pyro\pyro_lightwarp]]
: 适用于所有 {{L|Team Fortress 2|《军团要塞2》}} 角色,不仅是 Pyro。这种纹理创建了红色终止线的高对比阴影,体现了游戏独特的插画风格。
; 色调分层(自定义):[[File:Warp bw.png|border|自定义纹理]]
: 这种自定义光偏移纹理创造了一种色调分层的“线稿”风格。然而,仅启用光偏移还不够:环境光必须设置为 0 以使未受光区域为黑色,世界光照必须具有视图依赖性以确保始终投射阴影。
; 卡通渲染(自定义):[[File:Cel_lightwarp.png|border|自定义纹理]]
: 卡通渲染通过用清晰的光照分界替代平滑的光照渐变,让对象看起来更加卡通化。
 
其他可能的 {{code|$lightwarptexture}} 用途包括增强对比度、调整顶点光照阴影转换、柔化高光等。
 
::[[File:Celshadingpreview.png|thumb|320px|left|卡通渲染效果预览。]]
{{clr}}
 
== 参考资料 ==
<ol>
<li>[https://gamebanana.com/mods/466641 Lightwarp Fixes <nowiki>[Team Fortress 2] [Mods]</nowiki>] 在 GameBanana 上</li>
</ol>


{{ACategory|Shader parameters|l}}
{{ACategory|Shader parameters|l}}

Revision as of 04:08, 30 December 2024

该技术首次应用于《反恐精英:起源》(en)的雪地图,例如Kalt。
$lightwarptexture《军团要塞2》(en)独特角色渲染风格的重要元素。
可以实现色调分层,但需要对光照进行严格控制。

$lightwarptexture(DX9+ SM3)是一个用于着色器 VertexLitGeneric材质(en)着色器(en)参数,可在所有的 起源 起源 游戏,自从 起源2006 起源2006 以来中使用。 它根据明暗程度调整纹素的颜色,可以看作是局部的颜色校正

Note.png注意:同样适用于LightmappedGenericWorldVertexTransitionEyeRefract

注意事项

Icon-Important.png重要:$lightwarptexture 必须在所有其他纹理之后指定,否则会覆盖它们。
Icon-Important.png重要:确保纹理在VTF中启用钳位模式,否则会渲染错误。为此,请使用“Clamp S”和“Clamp T”图像标志
Icon-Important.png重要:VertexLitGeneric 中使用 $lightwarptexture 需要一个 $bumpmap。如果未指定,将使用默认的凹凸贴图!默认贴图将使 $bumpmap 看起来已在VMT中指定!
Warning.png警告:这意味着所有与 $bumpmap 不兼容的参数也无法与 $lightwarptexture 配合使用。
Note.png注意:起源2013 起源2013CS:GO 引擎分支 CS:GO 引擎分支 中,$lightwarptexture 需要与 $phong 一起使用,单独无效。
Note.png注意:$lightwarptextureLightmappedGeneric 中似乎在 CS:GO 引擎分支 CS:GO 引擎分支 中完全不存在。
Icon-Bug.png错误:LightmappedGenericWorldVertexTransition 中同时使用 $detail$bumpmap2 时无效。  [todo tested in ?]
Icon-Bug.png错误:使用 $selfillumfresnel 但未启用 $phong 时无效。  [todo tested in ?]
Icon-Bug.png错误:$seamless_scale 一起使用时无效。  [todo tested in ?]

光偏移纹理

光偏移纹理是一条一维像素带。暗纹素将被着色为左侧的颜色,亮纹素将被着色为右侧的颜色。50% 灰色表示无颜色偏移。

Note.png注意:光偏移在光照贴图的刷子和置换物上与顶点照明模型上表现略有不同。一个完全 50% 灰色的 $lightwarptexture 在刷子或置换物上看起来像没有光偏移一样,而在没有 phong 的模型上会表现为均匀受光(类似于GoldSrc的平面阴影纹理模式)。

VTF 参数

光偏移纹理应使用未压缩的 BGR888 格式,以避免光照渐变中出现不必要的颜色条纹[1],并启用 UV 钳位。

如果使用 VTEX VTEX,请使用以下编译参数:

nocompress 1 // 禁用纹理压缩,防止颜色条纹
nomip 1 // 禁用 mipmaps,在此情况下不必要
nolod 1 // 始终使用该纹理的全分辨率版本(由于本身分辨率较低)
clamps 1 // 防止在光照极端条件下颜色混合
clampt 1 // 可选?
stripalphachannel 1 // 如果存在,移除不必要的 alpha 通道

示例

🖿ground/snow_warp.vtf (胜利之日:起源)
dod\materials\ground\snow_warp
这是上方 《反恐精英:起源》(en) 屏幕截图中使用的光偏移纹理。它旨在为较暗的雪区域添加轻微的蓝色调,而不会影响较亮的区域。
🖿models/player/pyro/pyro_lightwarp.vtf (军团要塞2)
tf\materials\models\player\pyro\pyro_lightwarp
适用于所有 《军团要塞2》(en) 角色,不仅是 Pyro。这种纹理创建了红色终止线的高对比阴影,体现了游戏独特的插画风格。
色调分层(自定义):自定义纹理
这种自定义光偏移纹理创造了一种色调分层的“线稿”风格。然而,仅启用光偏移还不够:环境光必须设置为 0 以使未受光区域为黑色,世界光照必须具有视图依赖性以确保始终投射阴影。
卡通渲染(自定义):自定义纹理
卡通渲染通过用清晰的光照分界替代平滑的光照渐变,让对象看起来更加卡通化。

其他可能的 $lightwarptexture 用途包括增强对比度、调整顶点光照阴影转换、柔化高光等。

卡通渲染效果预览。

参考资料

  1. Lightwarp Fixes [Team Fortress 2] [Mods] 在 GameBanana 上