Unity Products:Amplify Shader Editor/Grab Screen Color
Grab Screen Color Node
The Grab Screen Color allows a Grab Pass to be used. This special pass grabs the contents of the screen when the object is about to be drawn into a texture which can then be fetched using screen space UV coordinates.
This node can either generate its internal UV coordinates or use custom ones if specified on the UV input port. By using the Grab Screen Position node alongside with this node it becomes very easy and intuitive to achieve effects like p.e. refraction.
When UV input port is left unconnected, internal generated UVs are similar on having a Grab Screen Position directly connected to it.
A custom texture name can also be used by activating the Custom Grab Pass toggle and specifying a new name into the Name. Please note that a Grab Pass behavior changes when specifying a custom texture name as the current screen contents will only be grabbed once per frame for the first object that used the given texture name. If no custom texture name is set then the current screen contents will be grabbed for each object that uses it.
Please check Unity official documentation for further information.
NOTE 1: Grab passes only works in the Forward rendering path. The grab texture will return incorrect results if used on a deferred only shader.
IMPORTANT: Scriptable Rendering Pipelines ( both Lightweight and HD ) don't support grab passes.
Nodes used: Grab Screen Position, Float, Texture Sample, Add, Grab Screen Color
|Node Parameter||Description||Default Value|
|Auto-Register||Creates Grab Pass even if not connected to an output node.||False|
|Mode|| Specify if this node is to register a new Grab Pass or to use one already created from another Grab Screen Color as reference
|Precision|| Defines the amount of bytes the variable can hold, effectively defining how precise the value is. It's usefulness is bond by the hardware specifications necessary. Lowest precision is slightly faster but might produce errors and artifacts.
|Normalize||Automatically performs the perspective division over the input UVs.||False|
|Custom Grab Pass|| A custom texture name can be used on the grab pass register process when turned on. Otherwise the default _GrabTexture sampler will be used.
Please note that when toggled off or no name is specified, a screen grab is done for each object that uses it, as opposed to when a name is specified the screen grab is only done once per frame for the first object that used the give texture name.
|Name||Specify a custom texture name which will have the current screen contents.||Grab Screen #|
|Property Name||This is the variable name that contains the value, this is automatically generated using the Name parameter, it's greyed out and not editable. The generation process removes special characters, whitespaces and adds an underscore at the beginning ( ie: "My Texture Name" becomes "_MyTextureName" )||_GrabScreen#|
|Reference||Select Grab Pass property from other Grab Screen Color node to be used as reference||None|
|UV||Specify current UV coordinates to be used on Grab Pass texture fetch. Auto-generate UVs similar on having a Grab Screen Position directly connected to it.||Float2|
|RGBA||Returns the current fetched color from the Grab Pass texture||Float4|
|R||Returns only the R component of the current fetched color from the Grab Pass texture||Float|
|G||Returns only the G component of the current fetched color from the Grab Pass texture||Float|
|B||Returns only the B component of the current fetched color from the Grab Pass texture||Float|
|A||Returns only the A component of the current fetched color from the Grab Pass texture||Float|