This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Mesh Transparent

Implements the basic render functionality for a transparent mesh. Can be used for the following objects (inherited from parent abstract material — Mesh):

Notice
Mesh Transparent has the same states and shaders available as the parent Mesh abstract material.

You can find the source code for this abstract material here: <SDK>/data/core/materials/abstract/mesh/mesh_transparent.abstmat

Features#

The Mesh Transparent abstract material has features implemented as internal states that can be enabled on demand in the child material:

State Name Default Conditions Description
transparent_blur false (none) Enables rendering of transparent blur effect.
refraction false (none) Enables rendering of post-processing refraction.
refraction_information_lost_fix false refraction Enables correction of refraction for “information lost” areas using information from areas beyond the object's internal volume.
refraction_front_side false refraction && refraction_information_lost_fix Renders refraction only for front faces. This option can be used for glass objects with no cavities inside. When enabled, the surface shall overlap all transparent objects located behind it.
planar_reflection false (none) Enables rendering of dynamic reflections. Using this option you can create realistic flat mirrors and flat reflective surfaces (parquet, flat varnished surfaces, etc.)
reflection_size 7 planar_reflection Reflection map size, in pixels. Possible values: [128, 256, 512, 1024, 2048, 4096, quart_height, half_height, height]
reflection_two_sided false (none) Use Two Sided option for reflections
reflection_show_pivot false (none) Enable two-sided planar reflection mode.
reflection_blur true (none) Show the reflection pivot point.
ambient_light true (none) Enables the support for two and more World Lights.
ambient true (none) Enable rendering of the material illuminated by an environment probe light source.
environment_probe true ambient Enable rendering of the material illuminated by an environment probe light source.
voxel_probe true ambient Enable rendering of the material illuminated by a voxel probe light source.
planar_probe true ambient Enable rendering of the material illuminated by a planar probe light source.
light_omni true (none) Enable rendering of the material illuminated by an omni light source.
light_proj true (none) Enable rendering of the material illuminated by a projected light source.
light_world true (none) Enable rendering of the material illuminated by a world light source.
multiple_environment_probes false environment_probe Illuminate a transparent object with several environment probes and map their cubemaps to this object.
lerp_cascades false (none) Lerp Cascades
shadow_filter_mode 2 (none) Filter Mode. Possible values: [none, low, medium, high ultra]
shadow_penumbra_mode 0 (none) Penumbra Mode. Possible values: [none, low, medium, high ultra]
shadow_filter_noise true (none) Filter Noise
shadow_penumbra_noise true (none) Penumbra Noise

Shaders#

fragment#

For every type of light the right PASS is called based on which one can choose the right shading logic:

  • transparent_blur
  • refraction
  • ambient
  • light_omni
  • light_proj
  • light_world
  • light_environment_probe
  • light_voxel_probe
  • light_planar_probe

Fragment shader has the following output values:

Output Data#

Name Type Description
OUT_FRAG_TRANSPARENT_REFRACTION float2 UV offset for transparent refraction (requires enabled transparent_blur and refraction)
OUT_FRAG_TRANSPARENT_BLUR float transparent blur radius

Textures#

Here’s the list of available textures that are pre-defined and used in fragment shader:

Texture name Texture type State Pass Description
TEX_REFLECTION_CUBE Cube ambient ambient Reflection cubemap
TEX_REFLECTION_2D 2D ambient && planar_reflection ambient Reflection texture
TEX_TRANSPARENT_ENVIRONMENT_PROBE 2D ambient && multiple_environment_probes ambient Environment probes rendered on transparent objects
TEX_SKY_LUT 2D Array ambient && ambient_light ambient An array of sky lookup tables
TEX_REFLECT 2D ambient light_planar_probe Planar reflection texture
TEX_REFLECT Cube ambient light_environment_probe Cube reflection texture
TEX_LIGHTMAP 2D lightmap ambient, deferred Baked lightmap texture

Usage Example#

ULON
BaseMaterial <parent=Unigine::mesh_transparent>
{
    Texture2D albedo = "core/textures/common/checker_d.dds"
    Color albedo = [1 1 1 0.5]
    
    // optimization
    State static_shadow = true
    State vertex_velocity = false
    
    Shader vertex_struct =
    #{
        INIT_BASE_DATA
    #}
    
    Shader common =
    #{
        float4 sample_color(float2 uv)
        {
            return TEXTURE(tex_albedo, uv) * var_albedo;
        }
    #}
    
    Shader fragment =
    #{
        float4 color = sample_color(DATA_UV.xy);
        
        OUT_FRAG_ALBEDO = color.rgb;
        OUT_FRAG_SPECULAR = 0.5f;
        OUT_FRAG_ROUGHNESS = 1.0f;
        OUT_FRAG_METALNESS = 0.0f;
        
        OUT_FRAG_OPACITY = color.a;
    #}
}
Last update: 2022-04-06
Build: ()