Unity Products:Amplify Shader Editor/Get Local Var and Unity Products:Amplify Shader Editor/Grab Screen Position: Difference between pages

From Amplify Creations Wiki
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
ampwiki>Amplify RnD Rick
 
Line 1: Line 1:
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
== Grab Screen Position Node ==


== Get Local Var Node ==
The Grab Screen Position node outputs a transformed screen position of the current pixel, ready to be directly used on a [[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Color|Grab Screen Color]] node.
According to the selected [[#paramType|Type]] parameter the position value can be either in Screen Coordinates, '''[ 0, Screen Width - 1 ]''' for X axis and '''[ 0, Screen Height - 1 ]''' for Y axis, or in a normalized '''[0,1]''' range for both axis.<br/>
'''NOTE:''' This node is similar to [[Unity_Products:Amplify_Shader_Editor/Screen_Position|Screen Position]] but internally does some additional steps to ensure that it takes both VR Single Pass Stereo and vertical orientation API differences ( Screen Space coordinates origin starting on top left corner instead of bottom left corner )  into account. This way when used with [[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Color|Grab Screen Color]] will always fetch the desired color from a Grab Pass.


The Get Local Var node ''( shortcut: G key )'' allows access to local values created via a [[Unity Products:Amplify Shader Editor/Register Local Var|Register Local Var]] node. This can be done by selecting a local variable through its [[#paramReference|Reference]] property available at the Node Properties window or upper left corner of the node body.
<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/GrabScreenPosAndColor.jpg">
<br/>'''NOTE:''' Using this node is similar to directly connect the '''Register Local Var''' output to where the value is needed.
 
<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/RegisterGetLocalVar.jpg">  
<br/><font size="1">Nodes used:  
<br/><font size="1">Nodes used:  
[[Unity_Products:Amplify_Shader_Editor/World_Normal|World Normal]],  
[[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Position|Grab Screen Position]],  
[[Unity_Products:Amplify_Shader_Editor/World_Space_Light_Dir|World Space Light Dir]],
[[Unity_Products:Amplify_Shader_Editor/Float|Float]],  
[[Unity_Products:Amplify_Shader_Editor/Dot|Dot]],
[[Unity_Products:Amplify_Shader_Editor/Texture_Sample|Texture Sample]],  
[[Unity_Products:Amplify_Shader_Editor/Register_Local_Var|Register Local Var]],  
[[Unity_Products:Amplify_Shader_Editor/Add|Add]],  
[[Unity_Products:Amplify_Shader_Editor/Get_Local_Var|Get Local Var]],  
[[Unity_Products:Amplify_Shader_Editor/Grab_Screen_Color|Grab Screen Color]]
[[Unity_Products:Amplify_Shader_Editor/Scale_And_Offset|Scale And Offset]],
[[Unity_Products:Amplify_Shader_Editor/Float|Float]],
[[Unity_Products:Amplify_Shader_Editor/Texture_Sample|Texture Sample]]
</font>
</font>


Line 22: Line 19:
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
|-
|-
| id="paramReference" | Reference
| id="paramType" | Type
| Lists all available local variables. Select one to be used by the node.
| Defines how the screen position value should be presented
| None
* '''Normalized:''' Position value is set on a [0,1] range for both x and y axis.
* '''Screen:''' Position value is set according to actual screen size.
| Normalized
|}
 
 
{| class="wikitable" style="width: 100%;"
|-
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
|-
| XYZW
| Returns the Grab Screen Position value
| Float4
|-
| X
| Returns only the X component of the Grab Screen Position
| Float
|-
| Y
| Returns only the Y component of the Grab Screen Position
| Float
|-
| Z
| Returns only the Z component of the Grab Screen Position
| Float
|-
| W
| Returns only the W component of the Grab Screen Position
| Float
|}
|}




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

Revision as of 16:52, 24 October 2017

Back to Node List

Grab Screen Position Node

The Grab Screen Position node outputs a transformed screen position of the current pixel, ready to be directly used on a Grab Screen Color node. According to the selected Type parameter the position value can be either in Screen Coordinates, [ 0, Screen Width - 1 ] for X axis and [ 0, Screen Height - 1 ] for Y axis, or in a normalized [0,1] range for both axis.
NOTE: This node is similar to Screen Position but internally does some additional steps to ensure that it takes both VR Single Pass Stereo and vertical orientation API differences ( Screen Space coordinates origin starting on top left corner instead of bottom left corner ) into account. This way when used with Grab Screen Color will always fetch the desired color from a Grab Pass.


Nodes used: Grab Screen Position, Float, Texture Sample, Add, Grab Screen Color

Node Parameter Description Default Value
Type Defines how the screen position value should be presented
  • Normalized: Position value is set on a [0,1] range for both x and y axis.
  • Screen: Position value is set according to actual screen size.
Normalized


Output Port Description Type
XYZW Returns the Grab Screen Position value Float4
X Returns only the X component of the Grab Screen Position Float
Y Returns only the Y component of the Grab Screen Position Float
Z Returns only the Z component of the Grab Screen Position Float
W Returns only the W component of the Grab Screen Position Float


Back to Node List