$color
< Zh
Jump to navigation
Jump to search

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 tries to comply with the alternate languages guide.
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 tries to comply with the alternate languages guide.
$color
是一个材质着色器 参数,可在所有的 起源 游戏中使用。
$color | |
---|---|
类型 | Material Shader parameter |
默认值 | "[1 1 1]" "{255 255 255}" |
引擎 | ![]() |
可用性 | 存在于所有的游戏中 |
着色器 | LightmappedGeneric UnlitGeneric VertexLitGeneric ![]() |
$color 独立缩放红、绿和蓝通道的反照率。有两种方式表示值:
语法
$color "[ <浮点数> <浮点数> <浮点数> ]" $color "{ <整数> <整数> <整数> }"


伽马
Source 引擎默认使用 2.2 的伽马校正。在试图调整纹理颜色以匹配屏幕截图中的某些其他颜色时(例如,尝试匹配天空盒材质底部的颜色与地图中的雾颜色时),必须考虑这一点。具体做法是将初步计算的比例提升至 2.2 的幂,然后设置材质的 $color
值。例如,如果屏幕截图中的样本(目标)颜色为 120,纹理在感兴趣点的颜色为 240,而您希望两种颜色匹配,则需要计算材质的反照率比例为 (120 / 240) ^ 2.2 = 0.218
(而非预期的 0.5)。

纯色
此参数可以在没有反照率贴图的情况下使用,以显示纯色而无需纹理(除了 %tooltexture
)。这不仅节省了一定的性能和内存开销,material_modify_control 还可以在运行时完全改变材质的颜色(如果需要)。
在这种情况下,"[1 1 1]"
是纯白色。

$color2
$color2 | |
---|---|
类型 | Material Shader parameter |
默认值 | "[1 1 1]" "{255 255 255}" |
引擎 | ![]() |
可用性 | 存在于所有的游戏中 |
着色器 | VertexLitGeneric SurfaceGGX WorldGGX |
$color2 的功能与 $color 相同,但用于模型材质。


语法
$color2 "[ <浮点数> <浮点数> <浮点数> ]" $color2 "{ <整数> <整数> <整数> }"

额外模型参数
- $blendtintbybasealpha <布尔值> (存在于自
以来) (也存在于
之中) (也存在于
之中)
- 启用使用 Alpha 蒙版来定义模型上的颜色区域。使用
$basetexture
的 Alpha 通道。错误:与 $alphatest 和 $translucent 不兼容。 [todo tested in ?]
错误:与 $selfillum 不兼容。如果两者同时使用,则忽略此参数。 [todo tested in ?]
- $blendtintcoloroverbase <浮点数> (仅存在于
之中) (也存在于
之中)
- 设置替换为纯色的量。值为 '0' 时为全色调,值为 '1.00' 时在遮罩区域用
$color2
定义的颜色替换反照率。默认值为 '0'。 - $tintmasktexture <纹理> (仅存在于
之中)
- 使用单独的纹理作为颜色调整遮罩,而非 $basetexture 的 Alpha 通道。仅绿色通道用于调整色调。
- $allowdiffusemodulation <布尔值> (存在于自
以来)
Shader: VertexLitGeneric - 防止模型的材质受
$color2
或rendercolor
调整。 - $notint <布尔值> (仅存在于
之中) (也存在于
之中)
Shader: VertexLitGeneric - 防止模型的材质受
$color2
或rendercolor
调整。
注意事项
$color2
与使用$selfillum
不兼容,因为它将覆盖$selfillum
和$selfillummask
所使用的发光属性。可以使用$selfillumtint
命令调整发光以使其正确显示。