Load Texture2D
Menu Path : Operator > Sampling > Load Texture2D
The Load Texture2D Operator allows you to read a Texture2D texel value for specified coordinates and mip level. This Operator returns the float4 texel value without any filtering.
This translates to a Load() call on the texture in High-Level Shading Language (HLSL). For information on the differences between loading and sampling, see Loading and sampling.
Loading and sampling
In the Visual Effect Graph, there are multiple Operators that can read texel values from a texture. In the underlying (HLSL), some of them use Load() and others use Sample().
The differences between the Operators that use Load() and Operators that use Sample() is as follows:
- Load() does not apply any filtering to the final texel value whereas Sample() uses the same Filter Mode as the target Texture's import settings.
- Load() does not apply any wrapping and instead returns 0 for coordinates that specify a texel outside the texture. Sample() uses the same Wrap Mode as the target Texture's import settings.
- Load() uses texel coordinates (in the range of 0 to the texture's width/height minus 1) whereas Sample() uses UV coordinates (in the range of 0-1).
Operator properties
Input | Type | Description |
---|---|---|
Texture | Texture2D | The Texture to read from. |
X | uint | The X coordinate of the texel to read. This is in the range of 0 to the width of the texture minus 1. |
Y | uint | The Y coordinate of the texel to read. This is in the range of 0 to the height of the texture minus 1. |
Mip Level | uint | The mip level to read from. |
Output | Type | Description |
---|---|---|
s | Vector4 | The value of the texel. |
Limitations
This is a GPU only Operator and therefore does not work when plugged into Spawn Context ports.