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

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


== World Space Light Dir Node ==
The World Space View Dir node calculates a non-normalized direction in world space from a position in object/local space given by its [[#paramInput|''Input'']] towards the camera. This node will also return the direction from the current game object to the camera if ''Input'' is left unconnected and its default internal value of (0,0,0,1) is used.


The World Space Light Dir node outputs a normalized light direction vector in world space coordinates.<br/>
<img class="responsive-img" src="http://wiki.amplify.pt/images/Nodes/WorldSpaceViewDir.jpg">
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/WorldSpaceLightDirNode.jpg">
<br/><font size="1">Nodes used:
[[Unity_Products:Amplify_Shader_Editor/World_Space_Light_Dir|World Space Light Dir]],
[[Unity_Products:Amplify_Shader_Editor/World_Normal|World Normal]],
[[Unity_Products:Amplify_Shader_Editor/Dot|Dot]]
</font>


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
|-
|-
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
|-
|- style="background: #e5e5e5;" |
| id="paramSafeNormalize" | Safe Normalize
| id="paramInput" | ''Input''
| Makes sure the light vector is not zero, even if there's no lights on scene.
| Position in object/local space. Only visible if the respective input port is not connected.
| False
| 0,0,0,1
|}
|}


{| class="wikitable" style="width: 100%;"
|-
! style="width: 10%;" | Input Port !! Description !! style="width: 10%;" | Type
|-
| ''Input''
| Position in object/local space.
| Float4
|}


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
Line 27: Line 28:
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
|-  
|-  
| id="paramXYZ" | XYZ
| XYZ
| Returns the light direction in world space coordinates.
| Returns the non-normalized direction in world space from the specified position towards the camera.
| Float3
| Float3
|-  
|-  
| id="paramX" | X
| X
| Returns the X component of the light direction in world space coordinates.
| Returns only the X component of the calculated direction.
| Float
| Float
|-  
|-  
| id="paramY" | Y
| Y
| Returns the Y component of the light direction in world space coordinates.
| Returns only the Y component of the calculated direction.
| Float
| Float
|-  
|-  
| id="paramZ" | Z
| Z
| Returns the Z component of the light direction in world space coordinates.
| Returns only the Z component of the calculated direction.
| 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:Light]]
[[Category:Nodes]][[Category:Object Transform]]

Latest revision as of 00:06, 2 December 2023

Back to Node List

World Space View Dir Node

The World Space View Dir node calculates a non-normalized direction in world space from a position in object/local space given by its Input towards the camera. This node will also return the direction from the current game object to the camera if Input is left unconnected and its default internal value of (0,0,0,1) is used.

Node Parameter Description Default Value
Input Position in object/local space. Only visible if the respective input port is not connected. 0,0,0,1
Input Port Description Type
Input Position in object/local space. Float4
Output Port Description Type
XYZ Returns the non-normalized direction in world space from the specified position towards the camera. Float3
X Returns only the X component of the calculated direction. Float
Y Returns only the Y component of the calculated direction. Float
Z Returns only the Z component of the calculated direction. Float

Back to Node List