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
Materials and Shaders
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
创建内容
内容优化
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Loop 示例

This material graph sample demonstrates how to use loops when creating materials.此材质图表示例演示了如何使用循环在创建材质时。

Albedo RGB data for the Mesh Opaque PBR material are generated in the loop: the initial texture (Texture node) is applied 32 times (Maximum Iterations) with a uniform UV shift along the points on a Vogel Disk controlled by the blur Slider parameter node (adjustable via the Parameters panel in UnigineEditor).Mesh Opaque PBR 材质的反照率RGB 数据在循环中生成:初始纹理(Texture 节点)应用 32 次 (Maximum Iterations),沿 Vogel Disk 上的点均匀 UV 偏移,由 blur Slider 参数节点控制(可通过 Parameters 调整UnigineEditor 中的面板)。

The Loop Begin node has the only variable Texture Sample float3 vector. The Maximum Iterations corresponds to the desired number of samples and is set to 32.Loop Begin 节点具有唯一的变量 Texture Sample float3 向量。 Maximum Iterations 对应于所需的样本数并设置为 32

The logic of each iteration lays between the Loop Begin and Loop End nodes. Each time the following steps are performed:每次迭代的逻辑位于 Loop BeginLoop End 节点之间。每次执行以下步骤:

  • The Index of the current iteration and the number of all iterations are passed to the Vogel Disk node providing a uniform UV shift.当前迭代的 Index 和所有迭代的次数被传递给 Vogel Disk 节点,提供统一的 UV 偏移。
  • The UV shift is multiplied by the blur value (divided by 10), i.e. the intensity of blur is changed.UV shift 乘以 blur 值(除以 10),即改变模糊的强度。
  • The resulting UV shift is added to the texture coordinates (Vertex UV 0 node).产生的 UV 偏移被添加到纹理坐标(Vertex UV 0 节点)。
  • The RGB value sampled from the texture is added to the previous Texture Sample value and passed to the Loop End node as the result of this iteration.将从纹理中采样的 RGB 值与之前的 Texture Sample 值相加,并作为本次迭代的结果传递给 Loop End 节点。

Thus the Texture Sample value is iteratively increasing up to the last iteration.因此 Texture Sample 值迭代地增加直到最后一次迭代。

The result of the Add node is also connected to the Divide node which performs color intensity reduction (divides the resulting value by the number of loop iterations - increments of color values).Add 节点的结果也连接到 Divide 节点,该节点执行颜色强度降低(将结果值除以循环迭代次数 - 颜色值的增量)。

最新更新: 2022-04-06
Build: ()