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

Zh/Water (shader): Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(chatgpt translation)
 
No edit summary
Line 181: Line 181:


== 另见 ==   
== 另见 ==   
* [[在Hammer中添加水]] 
* {{L|Adding Water|在Hammer中添加水}}
* [[创建瀑布材质]]  
* {{L|Creating a Waterfall Material|创建瀑布材质}}  
* [[制作水墙]]  
* {{L|Making a wall of water|制作水墙}}  
* [[CSS下的真实反射]]  
* {{L|True reflections under CSS|CSS下的真实反射}}  
[[Category:水]]
{{ACategory|Water}}

Revision as of 02:44, 23 June 2025

English (en)Français (fr)中文 (zh)Translate (Translate)
Info content.png
This page needs to be translated.
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
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)

Split-arrows.png 分裂

It has been suggested that this article or section be split into multiple articles: 水体(着色器)(en)液体材质(en)
后者应记录与着色器无关的参数,例如%CompileWater和%CompileSlime材质的相关参数。。 (Discuss)

水体是一个像素着色器(en),可在所有的 起源 起源 游戏中使用。

水体在Episode Two中实时反射实体。
《求生之路2》引入了流动水体光照贴图雾效

它能够创建真实地反射和折射场景的水体,并能在整个地图中流动。

Tip.png提示:水体(en)并不需要使用Water着色器!如果需要较不真实的效果,或者水体形状不规则,可以使用其他着色器,例如光照贴图通用材质(en)折射材质(en)。材质的创建方法是相同的。
待完善: 将与着色器无关的水体参数移动到一个单独的部分。

特殊行为

昂贵和廉价
水体材质分为两类:昂贵廉价。昂贵水体在实时反射和折射场景,而廉价水体使用$envmap并且不会折射。用户可以通过视频选项禁用昂贵水体渲染,因此在整个地图中始终放置env_cubemap实体。
水面上方和水面下方
水体实际上需要两个材质:一个在水面上,一个在水面下。这些材质是独立的,但为了获得正确的效果,必须在大部分区域内关联。
流动贴图
水体可以在任意方向流动。然而,手动创建流动贴图非常复杂,而Valve内部使用的工具尚未公开。

着色器参数

贴图

$basetexture

$abovewater $bottommaterial

Note.png注意:如果水面材质没有反射、折射或$underwateroverlay,可以省略$abovewater,可以使用[$nocull],并将$bottommaterial设置为与$abovewater材质相同的材质。

$underwateroverlay $bumpmap $normalmap $dudvframe $bumpframe $bumptransform $scale $flashlighttint $waterdepth $depth_feather

$fogenable $fogcolor

$fogstart $fogend $lightmapwaterfog

反射

$reflecttexture $reflectamount $reflecttint

$envmap $envmapframe $forceenvmap $forcecheap $forceexpensive $cheapwaterstartdistance $cheapwaterenddistance $reflectentities $reflectonlymarkedentities $reflectskyboxonly $reflect2dskybox $reflect3dskybox $reflectblendfactor $nofresnel $forcefresnel $basereflectance $maxreflectance

折射

$refract $refracttexture $refractamount $refracttint

$blurrefract $pseudotranslucent $waterblendfactor

流水

$scroll1 "[<normal X> <normal Y>]" (存在于自 起源2006 以来)
$scroll2 "[<normal X> <normal Y>]" (存在于自 起源2006 以来)
如果定义了$scroll1并且X值不为零,将绘制两个额外的法线图层,这些图层会合并在一起。第一个层级是原始法线图层的7倍大并旋转45°;第二个是原始法线图层的2倍大并旋转90°。参数指定了额外图层的移动速度和方向。(Valve的材质通常包含第三个数字,但它似乎没有显著效果,最可能已经过时。)

流动贴图

一个流动贴图。
引擎中流动贴图显示。
引擎中效果示例。

$flowmap $flow_normaluvscale $flow_worlduvscale $flow_uvscrolldistance $flow_timeintervalinseconds $flow_timescale $flow_bumpstrength $flow_noise_texture $flow_noise_scale $flow_debug

待完善: 添加黑山 黑山参数。

基础纹理流动

$basetexture $color_flow_uvscale $color_flow_timescale $color_flow_timeintervalinseconds $color_flow_uvscrolldistance $color_flow_lerpexp $color_flow_displacebynormalstrength

流动贴图的创作

流动贴图的水流方向取决于流动贴图的红绿通道。

总体来说,尝试手动创建流动贴图是一个噩梦。手动绘制流动贴图、将其调整到世界中、并绘制泡沫,非常困难。

但是,如果你想尝试,可以从流动贴图的红绿通道读取流动方向。50%灰度意味着没有移动。

使用流动贴图的水纹理的任何面贴图的纹理缩放似乎与流动贴图直接相关。使用较少的水面或平面时,创建自定义流动贴图的过程会更容易(当使用“视为一”功能进行缩放匹配时,选择所有水面也是一种可能的选择)。

红色通道
X轴
绿色通道
Y轴
透明度通道
控制从《Portal 2》起$basetexture的混合。
现在有工具可以帮助绘制流动贴图。
Flow field editor from algoholic.eu : http://algoholic.eu/another-flow-field-editor-update/ [dead link]
Flowmap generator (paid): http://www.superpositiongames.com/products/flowmap-generator
使用Houdini(UDK)创建流动贴图 : https://www.dropbox.com/s/ii2x077vj64lyhl/Water%20Flow%20For%20UDK.pdf [dead link]

其他

%CompileWater %CompileSlime $surfaceprop %tooltexture

WaterLOD proxy
这连接到水的内部参数的 water_lod_control 实体。必须在材质中声明它,以使LOD机制正常工作。

另见