This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Options

Options are not adjustable but fixed options of the material. They are used to set custom values for common material options. The type of ULON node is Option.

The syntax is the following:

ULON
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.
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 order

Depth mask GET_OPTION_DEPTH_MASK 0 or 1
Depth test GET_OPTION_DEPTH_TEST 0 or 1
Two sided GET_OPTION_TWO_SIDED 0 or 1
Cast shadow GET_OPTION_CAST_PROJ_OMNI_SHADOW 0 or 1
Cast world shadow GET_OPTION_CAST_WORLD_SHADOW 0 or 1
Overlap GET_OPTION_OVERLAP 0 or 1
  • OPTION_<option name in uppercase> — defined only if an option has a positive value.
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:

UUSL
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#

ULON
BaseMaterial 
{
	Option depth_test  = false
	Option transparent = 2
	Option blend_src	= src_alpha
	Option blend_dest	= one_minus_src_alpha
}

Types of Options#

blend_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:

  • zeroRGBA components of the source/destination image color are multiplied by zero.
  • oneRGBA components of the source/destination image color are multiplied by one.
  • src_colorRGBA components of the source/destination image color are multiplied by the mR, mG, mB, mA components (per component).
  • one_minus_src_colorRGBA components of the source/destination image color are multiplied by the 1 - mR, 1 - mG, 1 - mB, 1 - mA components (per component).
  • src_alphaRGBA components of the source/destination image color are multiplied by the mA component.
  • one_minus_src_alphaRGBA components of the source/destination image color are multiplied by the 1 - mA component.
  • dest_colorRGBA components of the source/destination image color are multiplied by the bR, bG, bB, bA components (per component).
  • one_minus_dest_colorRGBA components of the source/destination image color are multiplied by the 1 - bR, 1 - bG, 1 - bB, 1 - bA components (per component).
  • dest_alphaRGBA components of the source/destination image color are multiplied by the bA component.
  • one_minus_dest_alphaRGBA components of the source/destination image color are multiplied by the 1 - bA component.

mR, mG, mB, mA are normalized Red, Blue, Green and Alpha material image channels;

bR, bG, bB, bA are normalized Red, Blue, Green and Alpha background image channels.

blend_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:

  • zeroRGBA components of the source/destination image color are multiplied by zero.
  • oneRGBA components of the source/destination image color are multiplied by one.
  • src_colorRGBA components of the source/destination image color are multiplied by the mR, mG, mB, mA components (per component).
  • one_minus_src_colorRGBA components of the source/destination image color are multiplied by the 1 - mR, 1 - mG, 1 - mB, 1 - mA components (per component).
  • src_alphaRGBA components of the source/destination image color are multiplied by the mA component.
  • one_minus_src_alphaRGBA components of the source/destination image color are multiplied by the 1 - mA component.
  • dest_colorRGBA components of the source/destination image color are multiplied by the bR, bG, bB, bA components (per component).
  • one_minus_dest_colorRGBA components of the source/destination image color are multiplied by the 1 - bR, 1 - bG, 1 - bB, 1 - bA components (per component).
  • dest_alphaRGBA components of the source/destination image color are multiplied by the bA component.
  • one_minus_dest_alphaRGBA components of the source/destination image color are multiplied by the 1 - bA component.

mR, mG, mB, mA are normalized Red, Blue, Green and Alpha material image channels;

bR, bG, bB, bA are normalized Red, Blue, Green and Alpha background image channels.

order#

Char

Rendering order of the material. Specifies the priority of the material rendering (only for Object and 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).

shadow_mask#

Integer

A shadow mask used to control shadows cast by an object lit by light sources (only for Object and Decal).

Available values:

  • Integer number, representing a mask. The default value is ~0.

viewport_mask#

Integer

A viewport mask (only for Object and Decal).

Available values:

  • Integer number, representing a mask. The default value is ~0.

depth_mask#

Boolean

A flag indicating if writing in the depth buffer is enabled for a material (only for Object).

Available values:

  • false — not used
  • true — used (by default)

depth_test#

Boolean

A flag indicating if the Depth Test option is enabled for a material (only for Object).

Available values:

  • false — disabled
  • true — enabled (by default)

two_sided#

Boolean

A flag indicating if the Two Sided option is enabled for a material (only for Object).

Available values:

  • false — disabled (by default)
  • true — enabled

cast_shadow#

Boolean

A flag indicating if the Cast Proj and Omni Shadow option is enabled for a material (only for Object).

Available values:

  • false — disabled
  • true — enabled (by default)

cast_world_shadow#

Boolean

A flag indicating if the Cast World shadow option is enabled for a material (only for Object).

Available values:

  • false — disabled
  • true — enabled (by default)

transparent#

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.

Available values:

Integer

  • 0 = TRANSPARENT_NONE — opaque geometry that renders in deferred pass into GBuffer
  • 1 = TRANSPARENT_ALPHA_TEST — opaque geometry with enabled alpha test that renders in the deferred pass into GBuffer
  • 2 = TRANSPARENT_BLEND — transparent geometry that renders in forward passes
  • 3 = TRANSPARENT_WATER — water objects that renders in the deferred pass

or a String

  • none = TRANSPARENT_NONE
  • alpha_test = TRANSPARENT_ALPHA_TEST
  • blend = TRANSPARENT_BLEND
  • water = TRANSPARENT_WATER

overlap#

Boolean

A flag indicating if the Overlap option is enabled for a material (only for Object). This can be used for UI elements.

Available values:

  • false — disabled (by default)
  • true — enabled
Last update: 2021-12-13
Build: ()