选项
Fixed options of the material, their list cannot be changed. They are used to set custom values for common material options. The type of ULON node is Option.材料的固定选项,它们的列表不能更改。它们用于为常用材料选项设置自定义值。 ULON 节点的类型是 Option。
The syntax is the following:语法如下:
Option option_name = value(s)
Preprocessor Auto Generation for Shaders着色器的预处理器自动生成#
You can access options in the shader using the following defines:您可以使用以下定义访问着色器中的选项:
- GET_OPTION_<option name in uppercase> — available for all types of options.GET_OPTION_<option 大写的名称> — 适用于所有类型的选项。
Option name | Option's define | Possible values |
---|---|---|
Transparent | GET_OPTION_TRANSPARENT |
0 — opaque (default) 1 — alpha test 2 — blend 3 — water |
Order | GET_OPTION_ORDER |
-128..127 0 — default order0 — 默认顺序 |
Depth mask | GET_OPTION_DEPTH_MASK | 0 or 10 或 1 |
Depth test | GET_OPTION_DEPTH_TEST | 0 or 10 或 1 |
Two sided | GET_OPTION_TWO_SIDED | 0 or 10 或 1 |
Cast shadow | GET_OPTION_CAST_PROJ_OMNI_SHADOW | 0 or 10 或 1 |
Cast world shadow | GET_OPTION_CAST_WORLD_SHADOW | 0 or 10 或 1 |
Overlap | GET_OPTION_OVERLAP | 0 or 10 或 1 |
- OPTION_<option name in uppercase> — defined only if an option has a positive value.OPTION_<option name in大写> - 仅在选项具有正值时定义。
Option name | Option's define | Additional define(s) |
---|---|---|
Transparent | OPTION_TRANSPARENT |
0 — OPAQUE 1 — ALPHA_TEST 2 — TRANSPARENT_BLEND 3 — TRANSPARENT_WATER |
Order | OPTION_ORDER | — |
Depth mask | OPTION_DEPTH_MASK | — |
Depth test | OPTION_DEPTH_TEST | — |
Two sided | OPTION_TWO_SIDED | 1 — TWO_SIDED |
Cast shadow | OPTION_CAST_PROJ_OMNI_SHADOW | — |
Cast world shadow | OPTION_CAST_WORLD_SHADOW | — |
Overlap | OPTION_OVERLAP | 1 — OVERLAP_RENDER |
For various blend modes the source and destination defines are generated:
对于各种混合模式,生成 source 和 destination 定义:
BLEND_SRC_FUNC_<source blend option name in uppercase>
BLEND_DEST_FUNC_<destination blend option name in uppercase>
// Examples
BLEND_SRC_FUNC_SRC_ALPHA
BLEND_DEST_FUNC_ONE_MINUS_SRC_ALPHA
Usage Examples使用示例#
BaseMaterial
{
Option depth_test = false
Option transparent = 2
Option blend_src = src_alpha
Option blend_dest = one_minus_src_alpha
}
Arguments论据#
editableeditable#
Boolean
A flag indicating if option can be changed in the Parameters window or via API.指示选项是否可以在 Parameters 窗口或通过API .
Available values:可用值:
- false — unchangeablefalse — 不可更改
- true — changeable (by default)true — 可更改(默认)
hiddenhidden#
Boolean
A flag indicating if option is displayed in the Parameters window.指示选项是否显示在 Parameters 窗口中的标志。
Available values:可用值:
- false — displayed (by default)false — 显示(默认)
- true — hiddentrue — 隐藏
Types of Options选项类型#
blend_srcblend_src#
String
A node that allows you to set a blending option value (only for transparent objects and decals). It is a source image representing polygon color.一个节点,允许您设置混合选项值(仅适用于透明对象和贴花)。它是表示多边形颜色的源图像。
Available values:可用值:
- zero — RGBA components of the source/destination image color are multiplied by zero.zero — 源/目标图像颜色的 RGBA 分量乘以零。
- one — RGBA components of the source/destination image color are multiplied by one.one — 源/目标图像颜色的 RGBA 分量乘以 1。
- src_color — RGBA components of the source/destination image color are multiplied by the mR, mG, mB, mA components (per component).src_color — 源/目标图像颜色的 RGBA 分量乘以 mR, mG, mB, mA 分量(每个分量)。
- one_minus_src_color — RGBA components of the source/destination image color are multiplied by the 1 - mR, 1 - mG, 1 - mB, 1 - mA components (per component).one_minus_src_color — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)mR, 1(nbs)-(nbs)mG, 1(nbs)-(nbs)mB, 1(nbs)-(nbs)mA 分量(每个分量)。
- src_alpha — RGBA components of the source/destination image color are multiplied by the mA component.src_alpha — 源/目标图像颜色的 RGBA 分量乘以 mA 分量。
- one_minus_src_alpha — RGBA components of the source/destination image color are multiplied by the 1 - mA component.one_minus_src_alpha — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)mA 分量。
- dest_color — RGBA components of the source/destination image color are multiplied by the bR, bG, bB, bA components (per component).dest_color — 源/目标图像颜色的 RGBA 分量乘以 bR, bG, bB, bA 分量(每个分量)。
- one_minus_dest_color — RGBA components of the source/destination image color are multiplied by the 1 - bR, 1 - bG, 1 - bB, 1 - bA components (per component).one_minus_dest_color — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)bR, 1(nbs)-(nbs)bG, 1(nbs)-(nbs)bB, 1(nbs)-(nbs)bA 分量(每个分量)。
- dest_alpha — RGBA components of the source/destination image color are multiplied by the bA component.dest_alpha — 源/目标图像颜色的 RGBA 分量乘以 bA 分量。
- one_minus_dest_alpha — RGBA components of the source/destination image color are multiplied by the 1 - bA component.one_minus_dest_alpha — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)bA 分量。
mR, mG, mB, mA are normalized Red, Blue, Green and Alpha material image channels;mR, mG, mB, mA 是归一化的 Red, Blue, Green 和 Alpha 材质图像通道;
bR, bG, bB, bA are normalized Red, Blue, Green and Alpha background image channels.bR, bG, bB, bA 是归一化的 Red, Blue, Green 和 Alpha 背景图像通道。
blend_destblend_dest#
String
A node that allows you to set a blending option value (only for transparent objects and decals). It is a destination image representing screen buffer color.一个节点,允许您设置混合选项值(仅适用于透明对象和贴花)。它是表示屏幕缓冲区颜色的目标图像。
Available values:可用值:
- zero — RGBA components of the source/destination image color are multiplied by zero.zero — 源/目标图像颜色的 RGBA 分量乘以零。
- one — RGBA components of the source/destination image color are multiplied by one.one — 源/目标图像颜色的 RGBA 分量乘以 1。
- src_color — RGBA components of the source/destination image color are multiplied by the mR, mG, mB, mA components (per component).src_color — 源/目标图像颜色的 RGBA 分量乘以 mR, mG, mB, mA 分量(每个分量)。
- one_minus_src_color — RGBA components of the source/destination image color are multiplied by the 1 - mR, 1 - mG, 1 - mB, 1 - mA components (per component).one_minus_src_color — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)mR, 1(nbs)-(nbs)mG, 1(nbs)-(nbs)mB, 1(nbs)-(nbs)mA 分量(每个分量)。
- src_alpha — RGBA components of the source/destination image color are multiplied by the mA component.src_alpha — 源/目标图像颜色的 RGBA 分量乘以 mA 分量。
- one_minus_src_alpha — RGBA components of the source/destination image color are multiplied by the 1 - mA component.one_minus_src_alpha — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)mA 分量。
- dest_color — RGBA components of the source/destination image color are multiplied by the bR, bG, bB, bA components (per component).dest_color — 源/目标图像颜色的 RGBA 分量乘以 bR, bG, bB, bA 分量(每个分量)。
- one_minus_dest_color — RGBA components of the source/destination image color are multiplied by the 1 - bR, 1 - bG, 1 - bB, 1 - bA components (per component).one_minus_dest_color — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)bR, 1(nbs)-(nbs)bG, 1(nbs)-(nbs)bB, 1(nbs)-(nbs)bA 分量(每个分量)。
- dest_alpha — RGBA components of the source/destination image color are multiplied by the bA component.dest_alpha — 源/目标图像颜色的 RGBA 分量乘以 bA 分量。
- one_minus_dest_alpha — RGBA components of the source/destination image color are multiplied by the 1 - bA component. one_minus_dest_alpha — 源/目标图像颜色的 RGBA 分量乘以 1(nbs)-(nbs)bA 分量。
mR, mG, mB, mA are normalized Red, Blue, Green and Alpha material image channels;mR, mG, mB, mA 是归一化的 Red, Blue, Green 和 Alpha 材质图像通道;
bR, bG, bB, bA are normalized Red, Blue, Green and Alpha background image channels.bR, bG, bB, bA 是归一化的 Red, Blue, Green 和 Alpha 背景图像通道。
orderorder#
Char
Rendering order of the material. Specifies the priority of the material rendering (only for Object and Decal).渲染顺序的材料。指定材质渲染的优先级(仅适用于 Object 和 Decal)。
Available values:可用值:
- -128 .. 127. The default value is 0. The higher the rendering order, the lower the rendering priority (the material with the -128 order will be rendered first).-128 .. 127。默认值为 0。渲染顺序越高,渲染优先级越低(-128顺序的材质会先渲染)。
shadow_maskshadow_mask#
Integer
A shadow mask used to control shadows cast by an object lit by light sources (only for Object and Decal).一个 shadow 蒙版,用于控制由光源照亮的对象投射的阴影(仅适用于 Object 和 Decal)。
Available values:可用值:
- Integer number, representing a mask. The default value is ~0.Integer number,代表一个掩码。默认值为 ~0。
viewport_maskviewport_mask#
Integer
A viewport mask (only for Object and Decal).viewport 掩码(仅适用于 Object 和 Decal)。
Available values:可用值:
- Integer number, representing a mask. The default value is ~0.Integer number,代表一个掩码。默认值为 ~0。
depth_maskdepth_mask#
Boolean
A flag indicating if writing in the depth buffer is enabled for a material (only for Object).指示是否写入的标志深度缓冲区为材料启用(仅适用于 Object)。
Available values:可用值:
- false — not usedfalse — 未使用
- true — used (by default)true — 使用(默认)
depth_testdepth_test#
Boolean
A flag indicating if the Depth Test option is enabled for a material (only for Object).指示是否为材料启用 Depth Test 选项的标志(仅适用于 Object)。
Available values:可用值:
- false — disabledfalse — 禁用
- true — enabled (by default)true — 启用(默认)
two_sidedtwo_sided#
Boolean
A flag indicating if the Two Sided option is enabled for a material (only for Object).指示是否为材料启用 Two Sided 选项的标志(仅适用于 Object)。
Available values:可用值:
- false — disabled (by default)false — 禁用(默认)
- true — enabledtrue — 启用
cast_shadowcast_shadow#
Boolean
A flag indicating if the Cast Proj and Omni Shadow option is enabled for a material (only for Object).指示是否为材料启用 Cast Proj and Omni Shadow 选项的标志(仅适用于 Object)。
Available values:可用值:
- false — disabledfalse — 禁用
- true — enabled (by default)true — 启用(默认)
cast_world_shadowcast_world_shadow#
Boolean
A flag indicating if the Cast World shadow option is enabled for a material (only for Object).指示是否为材料启用 Cast World shadow 选项的标志(仅适用于 Object)。
Available values:可用值:
- false — disabledfalse — 禁用
- true — enabled (by default)true — 启用(默认)
transparenttransparent#
Indicates how and when an object with this material will be rendered (only for Object). A lower value gives a higher priority in the rendering queue.指示如何以及何时渲染具有此材质的对象(仅适用于 Object)。较低的值在渲染队列中给予较高的优先级。
Available values:可用值:
Integer整数
- 0 = TRANSPARENT_NONE — opaque geometry that renders in deferred pass into GBuffer0 = TRANSPARENT_NONE — 在延迟传递中渲染到 GBuffer 的不透明几何体
- 1 = TRANSPARENT_ALPHA_TEST — opaque geometry with enabled alpha test that renders in the deferred pass into GBuffer1 = TRANSPARENT_ALPHA_TEST — 启用 alpha 测试的不透明几何体,在延迟传递中呈现到 GBuffer
- 2 = TRANSPARENT_BLEND — transparent geometry that renders in forward passes2 = TRANSPARENT_BLEND — 在前向通道中渲染的透明几何体
- 3 = TRANSPARENT_WATER — water objects that renders in the deferred pass3 = TRANSPARENT_WATER — 在延迟通道中渲染的水对象
or a String或字符串
- none = TRANSPARENT_NONE
- alpha_test = TRANSPARENT_ALPHA_TEST
- blend = TRANSPARENT_BLEND
- water = TRANSPARENT_WATER