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.
Built-in Notes: Grab passes only works in the Forward rendering path. The grab texture will return incorrect results if used on a deferred only shader.
URP 3D Notes: For this node to correctly work with URP 3D Renderer users must:
- Go to their pipeline asset's inspector and activate the Opaque Texture toggle.
- Make sure the 2D Renderer option over this node is turned off.
URP 2D Notes: For this node to correctly work with URP 2D Renderer users must:
- Set the Foremost Sorting Layer on the 2D Asset Renderer to the last layer which is going to be caught by this node.
- Set the Sorting Layer of the sprite itself ( which will be using the shader with the Grab Screen Color node ) to one which is above the one specified on the previous step.
- Make sure the 2D Renderer' option over this node is turned on.
|Creates Grab Pass even if not connected to an output node.
|Specify if this node is to register a new Grab Pass or to use one already created from another Grab Screen Color as reference
|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.
|Automatically performs the perspective division over the input UVs.
|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.
|Specify a custom texture name which will have the current screen contents.
|Grab Screen #
|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" )
|Select Grab Pass property from other Grab Screen Color node to be used as reference
|Sets if fetched scene color value is affected by current exposure
|Selects if scene color fetch is to be made over the 3D Camera Opaque texture or the 2D Camera Sorting Layer texture
|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.
|Specify which LOD level of the HDRP color pyramid is to be used. (Only available on HDRP)
|Returns the current fetched color from the scene color texture
|Returns only the R component of the current fetched color from the scene color texture
|Returns only the G component of the current fetched color from the scene color texture
|Returns only the B component of the current fetched color from the scene color texture
|Returns only the A component of the current fetched color from the scene color texture