Unity Products:Amplify Shader Editor/Vertex Position and Unity Products:Amplify Shader Editor/World Space Light Dir: Difference between pages

From Amplify Creations Wiki
(Difference between pages)
Jump to navigation Jump to search
ampwiki>Amplify Borba
No edit summary
 
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]]
== Vertex Position Node ==


The Vertex Position node outputs the vertices position in object space. This data is extracted directly from the mesh and contains the vertex position relative to the object origin, this means the position values don't change whatever transform value your gameobject has. This is usually useful to use in the '''Local Vertex Offset''' output or to create effects that are bound to the object and stay exactly the same even if your gameobject changes position, rotation or size.
== World Space Light Dir Node ==
<br/>Depending on where this node is being used ( vertex or fragment/surface function ) it will either return a direct value ( on vertex functions ) or an interpolated value between vertices( on fragment/surface functions ).


'''NOTE:''' Do not confuse with [[Unity Products:Amplify Shader Editor/World Position|World Position]] node.  
The World Space Light Dir node outputs a normalized light direction vector in world space coordinates.<br/>
For directional lights, the output result is the direction from the light itself. As for point lights the resulting outputted vector is the one formed between the light position and the game object world space position.


<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/VertexPositionNode.gif">
<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/WorldSpaceLightDirNode.jpg">
<br/><font size="1">Nodes used:  
<br/><font size="1">Nodes used:  
[[Unity_Products:Amplify_Shader_Editor/Texture_Sample|Texture Sample]],
[[Unity_Products:Amplify_Shader_Editor/World_Space_Light_Dir|World Space Light Dir]],
[[Unity_Products:Amplify_Shader_Editor/Vertex_Position|Vertex Position]],
[[Unity_Products:Amplify_Shader_Editor/World_Normal|World Normal]],
[[Unity_Products:Amplify_Shader_Editor/Saturate|Saturate]],
[[Unity_Products:Amplify_Shader_Editor/Dot|Dot]]
[[Unity_Products:Amplify_Shader_Editor/Lerp|Lerp]]
</font>
</font>


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
|-  
|-
! style="width: 10%;" | Input Port !! Description !! style="width: 10%;" | Type
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
|-  
|-
| id="paramsize" | Size
| id="paramSafeNormalize" | Safe Normalize
| The size of the position vector.
| Makes sure the light vector is not zero, even if there's no lights on scene.
* '''XYZ:''' Retrieves the 3 coordinates position.
| False
* '''XYZW:''' Retrieves the 3 coordinates position and one more. This is mostly useful to facilitate matrix transformation operations where the W value is needed with the value 1 or if you want to retrieve packed data in the W channel.
| XYZ
|}
|}


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
Line 30: Line 27:
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
|-  
|-  
| XYZ(W)
| id="paramXYZ" | XYZ
| Returns the vertex position in object space
| Returns the light direction in world space coordinates.
| Float3(4)
| Float3
|-  
|-  
| X
| id="paramX" | X
| Returns only the X component of the vertex position
| Returns the X component of the light direction in world space coordinates.
| Float
| Float
|-  
|-  
| Y
| id="paramY" | Y
| Returns only the Y component of the vertex position
| Returns the Y component of the light direction in world space coordinates.
| Float
| Float
|-  
|-  
| Z
| id="paramZ" | Z
| Returns only the Z component of the vertex position
| Returns the Z component of the light direction in world space coordinates.
| Float
|- style="background: #e5e5e5;" |
| W
| Returns only the W component of the vertex position (By default set to 1). Only visible if [[#paramsize|Size]] is set to '''XYZW'''.
| Float
| Float
|}
|}


[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Category:Nodes]][[Category:Vertex Data]]
[[Category:Nodes]][[Category:Light]]

Revision as of 11:10, 12 July 2018

Back to Node List

World Space Light Dir Node

The World Space Light Dir node outputs a normalized light direction vector in world space coordinates.
For directional lights, the output result is the direction from the light itself. As for point lights the resulting outputted vector is the one formed between the light position and the game object world space position.


Nodes used: World Space Light Dir, World Normal, Dot

Node Parameter Description Default Value
Safe Normalize Makes sure the light vector is not zero, even if there's no lights on scene. False


Output Port Description Type
XYZ Returns the light direction in world space coordinates. Float3
X Returns the X component of the light direction in world space coordinates. Float
Y Returns the Y component of the light direction in world space coordinates. Float
Z Returns the Z component of the light direction in world space coordinates. Float

Back to Node List