This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 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

Custom Code 示例

This material graph sample demonstrates how to create and use nodes containing a custom shader code.此材质图表示例演示了如何创建和使用包含自定义着色器代码的节点。

Albedo RGB value for the material of the Mesh Opaque PBR type is specified directly using a Float node (casting to float3 is performed automatically).Mesh Opaque PBR 类型材质的反照率RGB 值直接使用 Float 节点指定(自动转换为 float3)。

The Function node has two float input ports (A and B) and two float output ports (return value Out and C output). They are automatically added according to the function signature:Function 节点有两个 float 输入端口(AB)和两个 float 输出端口(返回值 OutC 输出)。它们是根据函数签名自动添加的:

源代码 (Shader)
float function_1(in float a, in float b, out float c)
{
	c = lerp(a, b, 0.5f);
	return a+b;
}

A and B values for the custom function node are provided by Slider parameter nodes (adjustable via the Parameters panel in UnigineEditor) connected to it.自定义函数节点的 AB 值由与其相连的 Slider 参数节点(可通过 UnigineEditor 中的 Parameters 面板调整)提供。

The result of linear interpolation between A and B values is connected to the Roughness input port of the master material node, while the sum of A and B — to Metalness.AB 值之间线性插值的结果连接到主材质节点的 Roughness 输入端口,而 AB 之和 - 连接到 Metalness

Finally, the data output is passed to the Final node.最后,将数据输出传递给 Final 节点。

最新更新: 2024-01-18
Build: ()