Unity Products:Amplify Shader Editor/Projection Matrix and Unity Products:Amplify Shader Editor/Refract: Difference between pages

From Amplify Creations Wiki
(Difference between pages)
Jump to navigation Jump to search
ampwiki>Amplify RnD Rick
No edit summary
 
ampwiki>Kebrus
mNo edit summary
 
Line 1: Line 1:
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]


== Projection Matrix Node ==
== Refract Node ==


The projection Matrix node outputs the current Projection Matrix which can be used to transform either a position or direction vector from view space to clip space.
The Refract node calculates a refraction vector from a given [[#paramIncident|Incident]] vector, a surface [[#paramNormal|Normal]] vector and a ratio of [[#paramEta|Index of Refractions]] at the surface's interface.
Both Normal and Incident vector should be normalized.
 
A cast is done to match the input type with the most amount of channels if Normal and Incident vectors have different channel amounts. This will also determine the refracted vector size.
 
<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/RefractNode.gif">
<br/><font size="1">Nodes used:
[[Unity_Products:Amplify_Shader_Editor/View_Dir|View Dir]],
[[Unity_Products:Amplify_Shader_Editor/Negate|Negate]],
[[Unity_Products:Amplify_Shader_Editor/World_Normal|World_Normal]],
[[Unity_Products:Amplify_Shader_Editor/Float|Float]],
[[Unity_Products:Amplify_Shader_Editor/Refract|Refract]],
[[Unity_Products:Amplify_Shader_Editor/Texture Sample|Texture Sample]]
</font>
{| class="wikitable" style="width: 100%;"
|-
! style="width: 10%;" | Node Parameter !! Description !! style="width: 10%;" | Default Value
|- style="background: #e5e5e5;" |
| id="paramIncident" | Incident
| Incident vector ( should be normalized beforehand ). Only visible if the respective input port is not connected.
| 0,0,0,0
|- style="background: #e5e5e5;" |
| id="paramNormal" | Normal
| Normal vector ( should be normalized beforehand ). Only visible if the respective input port is not connected.
| 0,0,0,0
|- style="background: #e5e5e5;" |
| id="paramEta" | Eta
| Ratio of index of refraction, determines amount of incident ray that is refracted. Only visible if the respective input port is not connected.
| 0
|}


'''NOTE:''' We advise using either the [[Unity_Products:Amplify_Shader_Editor/Transform_Position|Transform Position]] or [[Unity_Products:Amplify_Shader_Editor/Transform_Direction|Transform Direction]] as they are easier to use and you wont need to do an explicit multiplication between matrix and position/direction value.


<img class="responsive-img" src="http://wiki.amplify.pt/images/Nodes/ProjectionMatrix.jpg">


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
|-  
|-  
! style="width: 10%;" | Output Port !! Description !! style="width: 10%;" | Type
! style="width: 10%;" | Input Port !! Description !! style="width: 10%;" | Type
|-
| Incident
| Incident vector ( should be normalized beforehand ).
| Float4 <sup id="ref1">[[#anchor|[1]]]</sup>
|-
| Normal
| Normal vector ( should be normalized beforehand ).
| Float4 <sup id="ref1">[[#anchor|[1]]]</sup>
|-  
|-  
| Out
| Eta
| Returns current projection matrix value.
| Ratio of index of refraction, determines amount of incident ray that is refracted.
| Matrix4x4
| Float
|}
|}


----
# <span id="anchor1">'''[[#ref1|^]]'''</span> Port automatically adapts to all connection types except Matrices and [[Unity Products:Amplify Shader Editor/Texture Object|Sampler]] types.


[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Category:Nodes]][[Category:Matrix Transform]]
[[Category:Nodes]][[Category:Vector Operators]]

Revision as of 17:47, 24 October 2017

Back to Node List

Refract Node

The Refract node calculates a refraction vector from a given Incident vector, a surface Normal vector and a ratio of Index of Refractions at the surface's interface. Both Normal and Incident vector should be normalized.

A cast is done to match the input type with the most amount of channels if Normal and Incident vectors have different channel amounts. This will also determine the refracted vector size.


Nodes used: View Dir, Negate, World_Normal, Float, Refract, Texture Sample

Node Parameter Description Default Value
Incident Incident vector ( should be normalized beforehand ). Only visible if the respective input port is not connected. 0,0,0,0
Normal Normal vector ( should be normalized beforehand ). Only visible if the respective input port is not connected. 0,0,0,0
Eta Ratio of index of refraction, determines amount of incident ray that is refracted. Only visible if the respective input port is not connected. 0


Input Port Description Type
Incident Incident vector ( should be normalized beforehand ). Float4 [1]
Normal Normal vector ( should be normalized beforehand ). Float4 [1]
Eta Ratio of index of refraction, determines amount of incident ray that is refracted. Float

  1. ^ Port automatically adapts to all connection types except Matrices and Sampler types.

Back to Node List