unity 之ShaderGraph 二

Sub Graph Asset

Node

一个节点包含一个或多个 input, output 和操作 operation ,一个节点也可能有任意数量的控件,这些是节点上没有端口的控件。

你可以折叠没有连接得节点,通过点击右上角的折叠按钮

For components of a Node see:

Preview

有些节点在节点上有预览.此预览将在图中显示该阶段的主要输出值. 当鼠标光标悬停在节点上时,将显示此输出信息.

Context Menu

在节点上右键

ItemDescription
Copy ShaderCopies the generated HLSL code at this stage in the graph to the clipboard
Disconnect AllRemoves all Edges from all Ports on the Node(s)
CutCuts selected Node(s) to the clipboard
CopyCopies selected Nodes(s) to the clipboard
PastePastes Node(s) in the clipboard
DeleteDeletes selected Node(s)
DuplicateDuplicates selected Node(s)
Convert To Sub-graph创建一个 Sub-graph Asset with the selected Node(s) included
Convert To Inline Node把属性节点转换成一个常规节点,数据类型保持一致 Property Node into a regular node of the appropriate Data Type
Convert To Property把常规节点转换成属性节点,并显示在blackboard上 Converts a Node into a new Property on the Blackboard of the appropriate Property Type
Open DocumentationOpens a new web browser to the selected Nodes documentation page in the Node Library

blackboard中的属性节点和工作区的属性节点二者是关联的,当blackboard中的源节点删除后,工作区的原属性节点就会变成常规节点,inline就是不关联的意思

 

 

Port

端口通过连线来传递数据.

每一个端口都定义了需要传入的数据的类型. 每一个数据类型都有它自己的一个颜色.

输入端口只能连接一条线,输出端口可以连接多条线

你也可以通过拖动鼠标拖动端口到工作区域来创建节点,这个节点的类型是这个输出端口数据类型能传入的类型

Default Inputs

节点左边的是输入端口, 当没有连接边缘时,这将作为一个小字段连接到端口. 除非端口具有端口绑定,否则此字段将显示端口数据类型的输入.如果一个有端口绑定的默认输入端口将显示一个特殊的框,比如选择uv通道的下拉框 ,或者是一个标签帮助你理解输入类型

 

 

Custom Port Menu

Custom Function NodeSub Graph 输出端口可以使用自定义端口. 你能够添加,删除,重命名,排序,定义端口的类型

How to Use

点击自定义节点的齿轮按钮,可以打开输入节点编辑器

Adding and Removing Ports

To remove ports, select a port using the hamburger icon on the left, and click the - icon at the bottom right corner of the port list.

03

Renaming Ports

双击重命名: A-Z, a-z, 0-9, _, ( ), and 空格键. .

04

Reordering Ports

拖拽左边的按钮编排顺序

Changing Port Types

右边编辑框改变数据类型

 

 

 

 

Property Types

在blackboard上的属性类型

Common Parameters

每一个属性都有以下三种参数

NameTypeDescription
Display NameString属性名
ExposedBoolean是否在material面板上显示
Reference NameStringc#引用名

NOTE: 引用名遵循以下规则

  • If your Reference Name 以下划线头,如果不是,会自动添加上
  • If your Reference Name 里面的字符必须是HLSL支持的,如果不支持,会自动去掉
  • 点击revert会复原原来的名字

Vector 1

Vector 1值,含有三种Mode

Data TypeModes
Vector 1Default, Slider, Integer

Default

默认值,显示一个参数输入区

FieldTypeDescription
DefaultVector 1The default value of the Property.

Slider

一个滑动条

FieldTypeDescription
DefaultVector 1The default value of the Property.
MinVector 1The minimum value of the slider.
MaxVector 1The maximum value of the slider.

Integer

整数区域

FieldTypeDescription
DefaultIntegerThe default value of the Property.

Vector 2

显示一个四维输入框,只不过z w 不使用 Vector 4 input field in the material inspector, where the z and w components are not used.

Data TypeModes
Vector 2 
FieldTypeDescription
DefaultVector 2The default value of the Property.

Vector 3

显示一个四维输入框,只不过 w 不使用. Displays a Vector 4 input field in the material inspector, where the w component is not used.

Data TypeModes
Vector 3 
FieldTypeDescription
DefaultVector 3The default value of the Property.

Vector 4

显示一个四维输入框  Displays a Vector 4 input field in the material inspector.

Data TypeModes
Vector 4 
FieldTypeDescription
DefaultVector 4The default value of the Property.

Color

Defines a Color value.

Data TypeModes
ColorDefault, HDR

Default

Displays an sRGB color field in the material inspector.

FieldTypeDescription
DefaultVector 4The default value of the Property.

HDR

Displays an HDR color field in the material inspector.

FieldTypeDescription
DefaultVector 4The default value of the Property.

Texture 2D

Defines a Texture 2D value. Displays an object field of type Texture in the material inspector.

Data TypeModes
TextureWhite, Black, Grey, Bump
FieldTypeDescription
DefaultTextureThe default value of the Property.

Texture 3D

Defines a Texture 3D value. Displays an object field of type Texture 3D in the material inspector.

Data TypeModes
Texture 
FieldTypeDescription
DefaultTextureThe default value of the Property.

Texture 2D Array

Defines a Texture 2D Array value. Displays an object field of type Texture 2D Array in the material inspector.

Data TypeModes
Texture 
FieldTypeDescription
DefaultTextureThe default value of the Property.

Cubemap

Defines a Cubemap value. Displays an object field of type Texture in the material inspector.

Data TypeModes
Cubemap 
FieldTypeDescription
DefaultCubemapThe default value of the Property.

Boolean

Defines a Boolean value. Displays a ToggleUI field in the material inspector. Note that internally to the shader this value is a Vector 1. The Boolean type in Shader Graph is merely for usability.

Data TypeModes
Boolean 
FieldTypeDescription
DefaultBooleanThe default value of the Property.

 

Precision Types

精度类型

Precision Types

NameDescription
Half16位中精度浮点类型; (range of –60000 to +60000,保留三位小数).
Half 对 short vectors, directions, object space positions, and high dynamic range colors.很有用
Float高精度浮点类型; generally 32 bits (identical to float in regular programming languages).
Full float precision 对 world space positions, texture coordinates, and scalar computations that involve complex functions such as trigonometry(三角), power, and exponentiation(幂).

 

Port Bindings

一些输入端口可能有端口绑定. 这表示这个端口需要一个输入连接,比如一个 Normal Vector or UV.但是, a Port Binding仅影响没有端口连接得端口. 这些端口仍然定义了需要介入的数据类型

实际上,这意味着如果没有边缘连接到端口,则该端口中使用的默认数据将从其端口绑定中获取.下面是端口绑定及其相关默认选项的完整列表。

Port Bindings List

NameData TypeOptionsDescription
BitangentVector 3 顶点或片段双重切线,能接入的数据类型是transform space
ColorVector 4 RGBA Color picker
ColorRGBVector 3 RGB Color picker
NormalVector 3 Vertex or fragment 法线向量 vector, label describes expected transform space
PositionVector 3 Vertex or fragment position, label describes expected transform space
Screen PositionVector 4 Default, Raw, Center, Tiled
TangentVector 3 Vertex or fragment tangent vector, label describes expected transform space
UVVector 2 UV0, UV1, UV2, UV3
Vertex ColorVector 4 RGBA vertex color value.
View DirectionVector 3 Vertex or fragment view direction vector, label describes expected transform space

 

Shader Stage

Shader Stage 指的是一个节点或端口所在的着色器管道的一部分. 比如:Vertex or Fragment.   在Shader Graph 中, Shader Stage 指每个端口,但通常一个节点上的所有端口都被锁定到相同的着色器阶段。由于底层着色器语言的限制,某些节点上的端口在某些着色器阶段不可用. See the Node Library documentation for Nodes that have Shader Stage restrictions.

Shader Stage List

NameDescription
Vertex每个顶点的运算
Fragment每个片段计算的操作

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TO_ZRG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值