Channel Nodes
Combine | Flip |
---|---|
控制输出颜色的每个通道.相当于自己创建一个颜色 | 调节各个通道的对比度 |
Split | Swizzle |
分离色调 | 在每个通道的基础上反转输入的颜色 |
Combine Node
根据自己输入的RGBA值来创建一个新的颜色
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
R | Input | Vector 1 | None | Defines red channel of output |
G | Input | Vector 1 | None | Defines green channel of output |
B | Input | Vector 1 | None | Defines blue channel of output |
A | Input | Vector 1 | None | Defines alpha channel of output |
RGBA | Output | Vector 4 | None | Output value as Vector 4 |
RGB | Output | Vector 3 | None | Output value as Vector 3 |
RG | Output | Vector 2 | None | Output value as Vector 2 |
Generated Code Example
The following example code represents one possible outcome of this node.
void Unity_Combine_float(float R, float G, float B, float A, out float4 RGBA, out float3 RGB, out float2 RG)
{
RGBA = float4(R, G, B, A);
RGB = float3(R, G, B);
RG = float2(R, G);
}
Flip Node
将节点参数选择的输入的各个通道翻转。正的值变成负的值,反之亦然,只显示打勾的通道所构成的颜色
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
In | Input | Dynamic Vector | None | Input value |
Out | Output | Dynamic Vector | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Red | Toggle | True, False | If true red channel will be flipped. |
Green | Toggle | True, False | If true green channel will be flipped. Disabled if In is Vector 1. |
Blue | Toggle | True, False | If true blue channel will be flipped. Disabled if In is Vector 2 or smaller. |
Alpha | Toggle | True, False | If true alpha channel will be flipped. Disabled if In is Vector 3 or smaller. |
Generated Code Example
The following example code represents one possible outcome of this node.
float2 _Flip_Flip = float4(Red, Green, Blue, Alpha);
void Unity_Flip_float4(float4 In, float4 Flip, out float4 Out)
{
Out = (Flip * -2 + 1) * In;
}
Split Node
把输入的一个颜色分成四个通道. 如果维度中的输入向量小于4(向量4),则输入中不存在的输出值将为0。
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
In | Input | Dynamic Vector | None | Input value |
R | Output | Vector 1 | None | Red channel from input |
G | Output | Vector 1 | None | Green channel from input |
B | Output | Vector 1 | None | Blue channel from input |
A | Output | Vector 1 | None | Alpha channel from input |
Generated Code Example
The following example code represents one possible outcome of this node.
float _Split_R = In[0];
float _Split_G = In[1];
float _Split_B = 0;
float _Split_A = 0;
Swizzle Node
创建与输入向量相同维度的新向量. :输出向量的通道与输入向量相同,但是根据节点上的下拉参数重新排序. 这叫做swizzling。通道下拉参数是动态的,取决于输入向量的维数的长度.不存在的通道的下拉菜单将被禁用,并且下拉菜单将只包含向量中存在的通道的条目。
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
In | Input | Dynamic Vector | None | Input value |
Out | Output | Dynamic Vector | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Red out | Dropdown | Red, Green, Blue, Alpha (depending on input vector dimension) | Defines which input channel should be used in the output's red channel |
Green out | Dropdown | Red, Green, Blue, Alpha (depending on input vector dimension) | Defines which input channel should be used in the output's green channel |
Blue out | Dropdown | Red, Green, Blue, Alpha (depending on input vector dimension) | Defines which input channel should be used in the output's blue channel |
Alpha out | Dropdown | Red, Green, Blue, Alpha (depending on input vector dimension) | Defines which input channel should be used in the output's alpha channel |
Generated Code Example
The following example code represents one possible outcome of this node.
float4 _Swizzle_Out = In.xzyw;
Input Nodes:输入节点
Basic
Boolean | Color |
---|---|
![]() | |
定义一个bool常量 | 定义一个四维的颜色常量vector4. |
Constant | Integer |
在着色器中定义一个数学常量值的Vector 1 | 顶一个一个整数 |
Slider | Time |
定义一个slider,和属性差不多,只不过一个是属性,一个式常规变量 | 提供对着色器中各种时间参数的访问。 |
Vector 1 | Vector 2 |
定义一个Vector 1 | Defines a Vector 2 value in the shader. |
Vector 3 | Vector 4 |
Defines a Vector 3 value in the shader. | Defines a Vector 4 value in the shader. |
Geometry
Bitangent Vector | Normal Vector |
---|---|
![]() | |
提供对网格顶点或片段的位元向量的访问. | 提供对网格顶点或片段的法向量的访问 |
Position | Screen Position |
![]() | |
Provides access to the mesh vertex or fragment's Position. | Provides access to the mesh vertex or fragment's Screen Position. |
Tangent Vector | UV |
![]() | |
Provides access to the mesh vertex or fragment's Tangent Vector. | 提供访问网格顶点或片段的UV坐标。 |
Vertex Color | View Direction |
![]() | |
提供对网格顶点或片段顶点颜色的访问 | Provides access to the mesh vertex or fragment's View Direction vector. |
Gradient
Gradient | Sample Gradient |
---|---|
定义一个渐变色 | 随时间变换的渐变色 |
Matrix
Matrix 2x2 | Matrix 3x3 |
---|---|
![]() | |
在着色器中定义一个常数矩阵2x2值。 | Defines a constant Matrix 3x3 value in the shader. |
Matrix 4x4 | Transformation Matrix |
![]() | |
Defines a constant Matrix 4x4 value in the shader. | 在着色器中为默认的单位变换矩阵定义一个常数矩阵4x4的值。 |
PBR
Dielectric Specular | Metal Reflectance |
---|---|
Returns a Dielectric Specular F0 value for a physically based material.为physically based material.返回一个Dielectric Specular F0 | Returns a Metal Reflectance value for a physically based material.返回physically based material的金属反射值。 |
Scene
Ambient | Camera |
---|---|
![]() | |
提供对场景环境颜色值的访问。 | 提供对当前相机的各种参数的访问 |
Fog | Baked GI |
![]() | |
提供对场景的雾参数的访问。 | Provides access to the Baked GI values at the vertex or fragment's position. |
Object | Reflection Probe |
![]() | ![]() |
提供对对象的各种参数的访问 | 提供对对象最近的反射探测的访问 |
Scene Color | Scene Depth |
提供对当前摄像机的颜色缓冲区的访问。 | 提供对当前摄像机深度缓冲区的访问 |
Screen | |
提供对屏幕参数的访问。 |
Texture
Cubemap Asset | Sample Cubemap |
---|---|
![]() | ![]() |
:定义用于着色器Cubemap。 | 对Cubemap进行采样,并返回一个Vector 4颜色值,以便在着色器中使用。 |
Sample Texture 2D | Sample Texture 2D Array |
![]() | |
Samples a Texture 2D and returns a color value for use in the shader. | 返回索引中的某个材质 |
Sample Texture 2D LOD | Sample Texture 3D |
Samples a Texture 2D at a specific LOD and returns a color value for use in the shader. | Samples a Texture 3D and returns a color value for use in the shader. |
Sampler State | Texel Size |
Defines a Sampler State for sampling textures. | 返回纹理2D输入的texel大小的宽度和高度 |
Texture 2D Array Asset | Texture 2D Asset |
Defines a constant Texture 2D Array Asset for use in the shader. | Defines a constant Texture 2D Asset for use in the shader. |
Texture 3D Asset | |
Defines a constant Texture 3D Asset for use in the shader. |
Boolean Node
定义一个bool值,可以和属性值相互转换通过convert to properties
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Out | Output | Boolean | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Toggle | Defines the output value. |
Generated Code Example
The following example code represents one possible outcome of this node.
float _Boolean = 1;
Color Node
定义一个颜色
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Out | Output | Vector 4 | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Color | Defines the output value. | ||
Mode | Dropdown | Default, HDR | Sets properties of the Color field |
Generated Code Example
float4 _Color = IsGammaSpace() ? float4(1, 2, 3, 4) : float4(SRGBToLinear(float3(1, 2, 3)), 4);
Constant Node
定义一个数学常量
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Out | Output | Vector 1 | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Mode | Dropdown | PI, TAU, PHI, E, SQRT2 | Sets output constant value |
Generated Code Example
The following example code represents one possible outcome of this node per constant type.
PI
float _Constant_PI = 3.1415926;
TAU
float _Constant_TAU = 6.28318530;
PHI
float _Constant_PHI = 1.618034;//黄金分割率φ 读fee
E
float _Constant_E = 2.718282;//自然数e
SQRT2
float _Constant_SQRT2 = 1.414214;//根号2
Time Node
Description
Provides access to various Time parameters in the shader.
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Time | Output | Vector 1 | None | Time value |
Sine Time | Output | Vector 1 | None | Sine of Time value |
Cosine Time | Output | Vector 1 | None | Cosine of Time value |
Delta Time | Output | Vector 1 | None | Current frame time |
Smooth Delta | Output | Vector 1 | None | Current frame time smoothed |
Generated Code Example
float Time_Time = _Time.y;
float Time_SineTime = _SinTime.w;
float Time_CosineTime = _CosTime.w;
float Time_DeltaTime = unity_DeltaTime.x;
float Time_SmoothDelta = unity_DeltaTime.z;
Ambient Node:环境光
获取场景中的环境光. 当环境光设置为 Gradient ,Color/Sky 端口返回的是Sky Color. 当环境光设置为 Color , Color/Sky 返回的是 Ambient Color. Ports Equator and Ground 总是返回值赤道颜色和地面颜色,不管当前环境照明源
Note: 这个值只在播放模式或者是保存场景/工程时才会更新,保存shader是不会更新的
Note: 此节点的行为全局未定义. 着色器图形没有定义节点的功能.相反,每个呈现管道为这个节点定义执行什么HLSL代码。
不同的渲染管道可能产生不同的结果.如果你在一个渲染管道中构建一个着色器,你想在两个渲染管道中都使用,在使用之前先试一遍. 一个节点可能在一个呈现管道中定义,而在另一个管道中未定义。如果此节点未定义,则返回0(黑色)
Unity Pipelines Supported
- Lightweight Render Pipeline
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Color/Sky | Output | Vector 3 | None | Color (Color) or Sky (Gradient) color value |
Equator | Output | Vector 3 | None | Equator (Gradient) color value |
Ground | Output | Vector 3 | None | Ground (Gradient) color value |
Generated Code Example
The following example code represents one possible outcome of this node.
float3 _Ambient_ColorSky = SHADERGRAPH_AMBIENT_SKY;
float3 _Ambient_Equator = SHADERGRAPH_AMBIENT_EQUATOR;
float3 _Ambient_Ground = SHADERGRAPH_AMBIENT_GROUND;
Camera Node
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Position | Output | Vector 3 | None | Position of the Camera's GameObject in world space摄像机的世界坐标 |
Direction | Output | Vector 3 | None | The Camera's forward vector direction摄像机的forward向量 |
Orthographic | Output | Vector 1 | None | Returns 1 if the Camera is orthographic, otherwise 0如果是正交模式,返回1,否则返回0 |
Near Plane | Output | Vector 1 | None | 近视面的距离 |
Far Plane | Output | Vector 1 | None | 远视面的距离 |
Z Buffer Sign | Output | Vector 1 | None | Returns -1 when using a reversed Z Buffer, otherwise 1:使用反向Z缓冲区时返回-1,否则返回1 |
Width | Output | Vector 1 | None | The Camera's width if orthographic正交模式下的的相机宽度 |
Height | Output | Vector 1 | None | The Camera's height if orthographic正交模式下的相机高度 |
Generated Code Example
The following example code represents one possible outcome of this node.
float3 _Camera_Position = _WorldSpaceCameraPos;
float3 _Camera_Direction = -1 * mul(UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz);
float _Camera_Orthographic = unity_OrthoParams.w;
float _Camera_NearPlane = _ProjectionParams.y;
float _Camera_FarPlane = _ProjectionParams.z;
float _Camera_ZBufferSign = _ProjectionParams.x;
float _Camera_Width = unity_OrthoParams.x;
float _Camera_Height = unity_OrthoParams.y;
Object Node
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Position | Output | Vector 3 | None | Object position in world space |
Scale | Output | Vector 3 | None | Object scale in world space |
Reflection Probe Node
Description
访问里物体最近的那个reflection probe, 需要 Normal and View Direction去采样probe. 通过使用LOD输入在不同的细节级别上采样,可以实现模糊效果。
Unity Pipelines Supported
- Lightweight Render Pipeline
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
View Dir | Input | Vector 3 | View Direction (object space) | Mesh's view direction |
Normal | Input | Vector 3 | Normal (object space) | Mesh's normal vector |
LOD | Input | Vector 1 | None | Level of detail for sampling |
Out | Output | Vector 3 | None | Output color value |
Generated Code Example
The following example code represents one possible outcome of this node.
void Unity_ReflectionProbe_float(float3 ViewDir, float3 Normal, float LOD, out float3 Out)
{
Out = SHADERGRAPH_REFLECTION_PROBE(ViewDir, Normal, LOD);
}
Scene Color Node
Description
通过输入uv访问当前摄像机的颜色缓存,这个uv是标准化的屏幕坐标
Note:在 Lightweight Render Pipeline返回 Camera Opaque Texture.只对transparent物体有效. Set the Surface Type dropdown on the Material Options panel of the Master Node to Transparent to receive the correct values from this node.
NOTE: This Node can only be used in the Fragment Shader Stage.
Unity Pipelines Supported
- Lightweight Render Pipeline
- High Definition Render Pipeline
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
UV | Input | Vector 4 | Screen Position | Normalized screen coordinates |
Out | Output | Vector 3 | None | Output value |
Generated Code Example
The following example code represents one possible outcome of this node.
void Unity_SceneColor_float(float4 UV, out float3 Out)
{
Out = SHADERGRAPH_SAMPLE_SCENE_COLOR(UV);
}
Scene Depth Node
Description
使用输入UV访问当前相机的深度缓冲,它需要一个归一化的屏幕坐标
Note: Depth buffer 访问深度缓存需要当前的渲染管线打开深度缓存 .如果没有打开的话,这个节点是灰色的
自定义的渲染管线需要定义它的功能,如果没有定义,默认返回1
NOTE: 支持Fragment Shader Stage.
Unity Pipelines Supported
- HD Render Pipeline
- Lightweight Render Pipeline
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
UV | Input | Vector 4 | Screen Position | Normalized screen coordinates |
Out | Output | Vector 1 | None | Output value |
Depth Sampling modes
Name | Description |
---|---|
Linear01 | 在0和1之间的线性深度值 |
Raw | 原始的深度值 |
Eye | 深度转换为眼距单位 |
Generated Code Example
The following example code represents one possible outcome of this node.
void Unity_SceneDepth_Raw_float(float4 UV, out float Out)
{
Out = SHADERGRAPH_SAMPLE_SCENE_DEPTH(UV);
}
Screen Node
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Width | Output | Vector 1 | None | 屏幕的宽度(以像素为单位) |
Height | Output | Vector 1 | None | 屏幕的高度(以像素为单位) |
Generated Code Example
The following example code represents one possible outcome of this node.
float _Screen_Width = _ScreenParams.x;
float _Screen_Height = _ScreenParams.y;
Cubemap Asset Node
定义一个 Cubemap Asset . 要采样Cubemap Asset 应该和 Sample Cubemap Node一起使用,当使用单独的Cubemap Asset Node时,你可以通过不同的参数采样 Cubemap 两次,而不需要两次定义Cubemap本身。
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Out | Output | Cubemap | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Object Field (Cubemap) | Defines the cubemap asset from the project. |
Sample Cubemap Node
对Cubemap进行采样,并返回一个Vector 4颜色值,以便在着色器中使用. 需要 View Direction and Normal输入来采样. 通过在不同的细节级别LOD上采样,可以实现模糊效果。您还可以使用自定义Sampler State采样
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Cube | Input | Cubemap | None | Cubemap to sample |
View Dir | Input | Vector 3 | View Direction (object space) | Mesh's view direction |
Normal | Input | Vector 3 | Normal (object space) | Mesh's normal vector |
Sampler | Input | Sampler State | Default sampler state | Sampler for the Cubemap |
LOD | Input | Vector 1 | None | Level of detail for sampling |
Out | Output | Vector 4 | None | Output value |
Generated Code Example
The following example code represents one possible outcome of this node.
float4 _SampleCubemap_Out = SAMPLE_TEXTURECUBE_LOD(Cubemap, Sampler, reflect(-ViewDir, Normal), LOD);
Sample Texture 2D Node
Description
对 Texture 2D 采样并返回一个Vector 4的颜色值,采样的意思就是把属性转换成能用的常规变量. 您可以使用输入UV覆盖UV坐标
要使用示例纹理2D节点对法线贴图进行采样,请将type下拉参数设置为normal
NOTE: 只能在Fragment Shader Stage. 在Vertex Shader Stage中对Texture 2D 采样,使用 Sample Texture 2D LOD Node instead.
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Texture | Input | Texture 2D | None | Texture 2D to sample |
UV | Input | Vector 2 | UV | Mesh's normal vector |
Sampler | Input | Sampler State | Default sampler state | Sampler for the texture |
RGBA | Output | Vector 4 | None | Output value as RGBA |
R | Output | Vector 1 | None | red (x) component of RGBA output |
G | Output | Vector 1 | None | green (y) component of RGBA output |
B | Output | Vector 1 | None | blue (z) component of RGBA output |
A | Output | Vector 1 | None | alpha (w) component of RGBA output |
Controls
Name | Type | Options | Description |
---|---|---|---|
Type | Dropdown | Default, Normal | Selects the texture type |
Sample Texture 2D Array Node
对Texture 2D Array采样,并返回一个Vector 4颜色值用于着色器. 使用索引输入来指定要采样的数组的索引。采样的意思就是把属性转换成能用的常规变量
NOTE: 此节点只能在片段着色器阶段使用 Fragment shader stage.
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Texture Array | Input | Texture 2D Array | None | Texture 2D Array to sample |
Index | Input | Vector 1 | None | Index of array to sample |
UV | Input | Vector 2 | UV | Mesh's normal vector |
Sampler | Input | Sampler State | Default sampler state | Sampler for the texture |
RGBA | Output | Vector 4 | None | Output value as RGBA |
R | Output | Vector 1 | None | red (x) component of RGBA output |
G | Output | Vector 1 | None | green (y) component of RGBA output |
B | Output | Vector 1 | None | blue (z) component of RGBA output |
A | Output | Vector 1 | None | alpha (w) component of RGBA output |
Generated Code Example
The following example code represents one possible outcome of this node.
float4 _SampleTexture2DArray_RGBA = SAMPLE_TEXTURE2D_ARRAY(Texture, Sampler, UV, Index);
float _SampleTexture2DArray_R = _SampleTexture2DArray_RGBA.r;
float _SampleTexture2DArray_G = _SampleTexture2DArray_RGBA.g;
float _SampleTexture2DArray_B = _SampleTexture2DArray_RGBA.b;
float _SampleTexture2DArray_A = _SampleTexture2DArray_RGBA.a;
Sample Texture 2D LOD Node
对Texture 2D Array采样,并返回一个Vector 4颜色值用于着色器. 使用索引输入来指定要采样的数组的索引。采样的意思就是把属性转换成能用的常规变量. 使用LOD输入来调整示例的LOD级别
要使用示例纹理2D节点对法线贴图进行采样,请将type下拉参数设置为normal
这个可以在 vertex Shader Stage 对Texture 进行采样,因为Sample Texture 2D Node 在这里不能用
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Texture | Input | Texture 2D | None | Texture 2D to sample |
UV | Input | Vector 2 | UV | Mesh's normal vector |
Sampler | Input | Sampler State | Default sampler state | Sampler for the texture |
LOD | Input | Vector 1 | None | Level of detail to sample |
RGBA | Output | Vector 4 | None | Output value as RGBA |
R | Output | Vector 1 | None | red (x) component of RGBA output |
G | Output | Vector 1 | None | green (y) component of RGBA output |
B | Output | Vector 1 | None | blue (z) component of RGBA output |
A | Output | Vector 1 | None | alpha (w) component of RGBA output |
Controls
Name | Type | Options | Description |
---|---|---|---|
Type | Dropdown | Default, Normal | Selects the texture type |
Default
float4 _SampleTexture2DLOD_RGBA = SAMPLE_TEXTURE2D_LOD(Texture, Sampler, UV, LOD);
float _SampleTexture2DLOD_R = _SampleTexture2DLOD_RGBA.r;
float _SampleTexture2DLOD_G = _SampleTexture2DLOD_RGBA.g;
float _SampleTexture2DLOD_B = _SampleTexture2DLOD_RGBA.b;
float _SampleTexture2DLOD_A = _SampleTexture2DLOD_RGBA.a;
Normal
float4 _SampleTexture2DLOD_RGBA = SAMPLE_TEXTURE2D_LOD(Texture, Sampler, UV, LOD);
_SampleTexture2DLOD_RGBA.rgb = UnpackNormalRGorAG(_SampleTexture2DLOD_RGBA);
float _SampleTexture2DLOD_R = _SampleTexture2DLOD_RGBA.r;
float _SampleTexture2DLOD_G = _SampleTexture2DLOD_RGBA.g;
float _SampleTexture2DLOD_B = _SampleTexture2DLOD_RGBA.b;
float _SampleTexture2DLOD_A = _SampleTexture2DLOD_RGBA.a;
Sample Texture 3D Node
对Texture 3D 采样,并返回一个Vector 4颜色值用于着色器. 使用索引输入来指定要采样的数组的索引。采样的意思就是把属性转换成能用的常规变量
NOTE: 只能在 Fragment Shader Stage.使用
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Texture | Input | Texture 3D | None | Texture 3D to sample |
UV | Input | Vector 3 | None | 3 dimnensional UV coordinates |
Sampler | Input | Sampler State | Default sampler state | Sampler for the texture |
RGBA | Output | Vector 4 | None | Output value as RGBA |
Generated Code Example
The following example code represents one possible outcome of this node.
float4 _SampleTexture3D_Out = SAMPLE_TEXTURE3D(Texture, Sampler, UV);
Sampler State Node
定义一个 Sampler State . 他应该和采样节点一起使用,比如:Sample Texture 2D Node.
当使用一个单独的采样状态节点时,您可以对一个纹理2D采样两次,使用不同的采样器参数,无需两次定义纹理本身。就是说一个材质可以使用两次,通过设置不同的参数
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Out | Output | Sampler State | None | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Filter | Dropdown | Linear, Point, Trilinear | Defines filtering mode for sampling. |
Wrap | Dropdown | Repeat, Clamp, Mirror, MirrorOnce | Defines wrap mode for sampling. |
Generated Code Example
The following example code represents one possible outcome of this node.
SamplerState _SamplerState_Out = _SamplerState_Linear_Repeat_sampler;
Texel Size Node
Description
返回纹理2D输入的texel大小的宽度和高度.使用内置的变量{texturename}_TexelSize来访问纹理2D的特殊属性。
Note: 不要直接使用从属性面板上拖下来的,那会报错,应该使用 Texture 2D Asset Node 来引用,然后再使用这个节点
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
Texture | Input | Texture | None | Texture asset |
Width | Output | Vector 1 | None | Texel width |
Height | Output | Vector 1 | None | Texel height |
Generated Code Example
The following example code represents one possible outcome of this node.
float _TexelSize_Width = Texture_TexelSize.z;
float _TexelSize_Height = Texture_TexelSize.w;
Texture 2D Asset Node
定义一个 Texture 2D Asset 以供在shader中使用, Texture 2D Asset 应该和 Sample Texture 2D Node.一起使用
Ports
Name | Direction | Type | Description |
---|---|---|---|
Out | Output | Texture 2D | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Object Field (Texture) | Defines the texture 3D asset from the project. |
Generated Code Example
The following example code represents one possible outcome of this node.
TEXTURE2D(_Texture2DAsset);
SAMPLER(sampler_Texture2DAsset);
Texture 2D Array Asset Node
定义一个 Texture 2D Array Asset在shader里使用. 它Tex应该和ture 2D Array Asset Sample Texture 2D Array Node一起使用. W,因为这样才能转化成可以用的材质,
Ports
Name | Direction | Type | Description |
---|---|---|---|
Out | Output | Texture 2D Array | Output value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Object Field (Texture 2D Array) | Defines the texture 2D array asset from the project. |
Generated Code Example
The following example code represents one possible outcome of this node.
TEXTURE2D_ARRAY(_Texture2DArrayAsset);
SAMPLER(sampler_Texture2DArrayAsset);