Unity Products:Amplify Shader Editor/Grab Screen Color and Unity Products:Amplify Shader Editor/Gradient: Difference between pages

From Amplify Creations Wiki
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
ampwiki>Amplify RnD Rick
(Created page with "== Gradient Node == The Gradient Node creates a gradient object which must be connected with a Gradient Sample node t...")
 
Line 1: Line 1:
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
== Gradient Node ==
== 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.<br/>
 
This node can either generate its internal UV coordinates or use custom ones if specified on the [[#paramUV|UV]] input port. By using the [[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Position| Grab Screen Position]] node alongside with this node it becomes very easy and intuitive to achieve effects like p.e. refraction.<br/>
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 [[#paramCustomGrabPass|Custom Grab Pass]] toggle and specifying a new name into the [[#paramGrabPassName|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.
The Gradient Node creates a gradient object which must be connected with a [[Unity_Products:Amplify_Shader_Editor/Gradient_Sample|Gradient Sample]] node to sample each of its colors on a given Time.
Please check Unity [https://docs.unity3d.com/Manual/SL-GrabPass.html official documentation] for further information.<br/>
<br/>
'''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.<br/>
'''URP 3D Notes:''' For this node to correctly work with '''URP 3D Renderer''' users must:<br/>
* Go to their pipeline asset's inspector and activate the '''Opaque Texture''' toggle.<br/>
* Make sure the [[#param2DRenderer|2D Renderer]] option over this node is turned off.<br/>
'''URP 2D Notes:''' For this node to correctly work with '''URP 2D Renderer''' users must:<br/>
* 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 [[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Color|Grab Screen Color]] node ) to one which is above the one specified on the previous step.
* Make sure the [[#param2DRenderer|2D Renderer]]' option over this node is turned on.<br/>


<br/>
<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/GradientSampleNode.jpg">
<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/GrabScreenPosAndColor.jpg">
<br/><font size="1">Nodes used:  
<br/><font size="1">Nodes used:  
[[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Position|Grab Screen Position]],  
[[Unity_Products:Amplify_Shader_Editor/Gradient|Gradient]],
[[Unity_Products:Amplify_Shader_Editor/Float|Float]],  
[[Unity_Products:Amplify_Shader_Editor/Texture_Coordinates|Texture Coordinates]],  
[[Unity_Products:Amplify_Shader_Editor/Texture_Sample|Texture Sample]],
[[Unity_Products:Amplify_Shader_Editor/Gradient_Sample|Gradient Sample]]
[[Unity_Products:Amplify_Shader_Editor/Add|Add]],
[[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Color|Grab Screen Color]]
</font>
</font>
{| class="wikitable" style="width: 100%;"
|-
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
|-
| id="paramAutoRegister" | Auto-Register
| Creates Grab Pass even if not connected to an output node.
| False
|-
| id="paramMode" | 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
* '''Object:'''  Register a new Grab Pass
* '''Reference:''' Use Grab Pass registered by referenced Grab Screen Color node
| Object
|-
| id="paramprecision" | 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.
* '''Float:''' Highest precision, useful for values that can be very high or very low in value (ie: positions, coordinates, etc)
* '''Half:''' Medium precision, in most cases is as good as '''Float''' but at half of it's precision
| Float
|-
| id="paramNormalize" | Normalize
| Automatically performs the perspective division over the input UVs.
| False
|-
| colspan="3" style="background:white; text-align: center; font-size: 11px;"| Object
|- style="background: #e5e5e5;" |
| id="paramCustomGrabPass" | 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.
| False
|- style="background: #e5e5e5;" |
| id="paramGrabPassName" | Name
| Specify a custom texture name which will have the current screen contents.
| Grab Screen #
|- style="background: #e5e5e5;" |
| id="paramGrabPassProperty Name" | 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#
|-
| colspan="3" style="background:white; text-align: center; font-size: 11px;"| Reference
|- style="background: #e5e5e5;" |
| id="paramReference" | Reference
| Select Grab Pass property from other Grab Screen Color node to be used as reference
| None
|-
| colspan="3" style="background:white; text-align: center; font-size: 11px;"| HDRP
|- style="background: #e5e5e5;" |
| id="paramExposure" | Exposure
| Sets if fetched scene color value is affected by current exposure
| False
|-
| colspan="3" style="background:white; text-align: center; font-size: 11px;"| URP
|- style="background: #e5e5e5;" |
| id="param2DRenderer" | 2D Renderer
| Selects if scene color fetch is to be made over the 3D Camera Opaque texture or the 2D Camera Sorting Layer texture
| False
|}
{| class="wikitable" style="width: 100%;"
|-
! style="width: 10%;" | Input Port !! Description !! style="width: 10%;" | Type
|-
| 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
|- style="background: #e5e5e5;" |
| LOD
| Specify which LOD level of the HDRP color pyramid is to be used. (Only available on HDRP)
| Float
|}




Line 106: Line 15:
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
|-  
|-  
| RGBA
| Value
| Returns the current fetched color from the scene color texture
| Returns the gradient object to be sampled.
| Float4
| Object
|-
| R
| Returns only the R component of the current fetched color from the scene color texture
| Float
|-
| G
| Returns only the G component of the current fetched color from the scene color texture
| Float
|-
| B
| Returns only the B component of the current fetched color from the scene color texture
| Float
|-
| A
| Returns only the A component of the current fetched color from the scene color texture
| Float
|}
|}


[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Category:Nodes]][[Category:Camera and Screen]]
[[Category:Nodes]][[Category:Constants And Properties]]

Revision as of 12:33, 29 July 2019

Gradient Node

The Gradient Node creates a gradient object which must be connected with a Gradient Sample node to sample each of its colors on a given Time.


Nodes used: Gradient, Texture Coordinates, Gradient Sample


Output Port Description Type
Value Returns the gradient object to be sampled. Object

Back to Node List