Unity Products:Amplify Shader Editor/Matrix4X4 and Unity Products:Amplify Shader Editor/Matrix From Vectors: Difference between pages

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


The Matrix4x4 node generates a 4x4 Matrix variable containing a total of 16 float components. Matrix variables cannot be set as shader properties so, unlike other property nodes like [[Unity_Products:Amplify_Shader_Editor/Float|Float]] or [[Unity_Products:Amplify_Shader_Editor/Vector4|Vector4]], their [[#paramtype|Type]] can only be set as Constant or Global.
== Matrix From Vector Node ==
These type of data structures are commonly used on different situations like transforming data between different coordinate spaces, per example transforming a position from local to world space, rotating vector position or directions among others.


<br/>'''NOTE:''' Most of the more commonly used transform matrices already have specific nodes like p.e. [[Unity_Products:Amplify_Shader_Editor/Object_To_World|Object To World ]] or [[Unity_Products:Amplify_Shader_Editor/World_To_Object|World To Object]].
The Matrix From Vector node creates and outputs a matrix from vectors specified by its input parameters and size specified by its [[#paramOutputType|Output Type]].<br/>


<img class="responsive-img" src="http://wiki.amplify.pt/images/NodeDetail/MatrixFromVectorsNode.jpg">
<br/><font size="1">Nodes used:
[[Unity_Products:Amplify_Shader_Editor/Vertex_Normal|Vertex Normal]],
[[Unity_Products:Amplify_Shader_Editor/Vertex_Tangent|Vertex Tangent]],
[[Unity_Products:Amplify_Shader_Editor/Cross|Cross]],
[[Unity_Products:Amplify_Shader_Editor/Matrix_From_Vectors|Matrix From Vectors]],
[[Unity_Products:Amplify_Shader_Editor/Vertex_Position|Vertex Position]],
[[Unity_Products:Amplify_Shader_Editor/Multiply|Multiply]]
</font>


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
Line 11: 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="paramtype" | Type  
| id="paramOutputType" | Output Type
| A set of ways the value behaves in different situations.
| Specifies the size of the matrix to be created and outputted
* '''Constant:''' the value is assigned directly in shader code and can't be dynamically changed.
* '''Matrix3x3:''' Creates a 3x3 matrix from three float3 vectors specified by the node input
* '''Global:''' the value can only be set by script and this defines a static variable that is shared between all shaders that use it. It's useful to change a value globally.
* '''Matrix4x4:''' Creates a 4x4 matrix from four float4 vectors specified by the node input
* '''Instanced:''' the value can only be set by script and this defines the shader as an instanced shader. ( see more here: [https://docs.unity3d.com/Manual/GPUInstancing.html GPU Instancing] )
| Matrix3x3
* '''CBuffer:''' the variable is set inside '''UnityPerMaterial''' constant buffer. Only available over SRP(HDRP/URP) shader types.
| Constant
|-
| id="paramname" | Name
| Name to used on generating the shader [[#parampname|Global Variable]] name if its type is set to [[#paramtype|Global]]. Otherwise it is ignored but still useful for organization purposes
| Matrix #
|-
|-
| id="paramInputToRow" | Input to Row
| Specifies if input vectors are matrix rows or columns.
| true
|- style="background: #e5e5e5;" |
| id="param0" | [0]
| Vector to be placed at the matrix first row/column. Only visible if the respective input port is not connected.
| 0,0,0
|- style="background: #e5e5e5;" |
| id="param1" | [1]
| Vector to be placed at the matrix second row/column.. Only visible if the respective input port is not connected.
| 0,0,0
|- style="background: #e5e5e5;" |
|- style="background: #e5e5e5;" |
| id="paramVariable Mode" | Variable Mode
|id="param2" | [2] 
| Defines if the current global variable is to be created on the current shader.
|Vector to be placed at the matrix third row/column. Only visible if the respective input port is not connected.
* '''Create:''' Global variable is created in the shader
| 0,0,0
* '''Fetch:''' Does not register variable, useful when p.e. there's need to using global variables declared over a included cginc
| Create
|-
|- style="background: #e5e5e5;" |
|- style="background: #e5e5e5;" |
| id="paramAutoRegister Mode" | Auto-Register
|id="param3" | [3] 
| If toggled on, creates the property and/or global variable even if not connected to an Output node
| Vector to be placed at the matrix fourth row/column. Only visible if the respective input port is not connected and Output Type is Matrix4x4.
| Off
| 0,0,0,0
|}
 
{| class="wikitable" style="width: 100%;"
|-
! style="width: 10%;" | Input Port !! Description !! style="width: 10%;" | Type
|-
| [0]
| Vector to be placed at the matrix first row/column.
| Float3/Float4
|-
| [1]
| Vector to be placed at the matrix second row/column.
| Float3/Float4
|-
|-
| [2]
| Vector to be placed at the matrix third row/column.
| Float3/Float4
|- style="background: #e5e5e5;" |
|- style="background: #e5e5e5;" |
| id="paramprecision" | Precision
| [3]
| 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.
| Vector to be placed at the matrix fourth row/column. Only available when Output Type is Matrix4x4.
* '''Float:''' Highest precision, useful for values that can be very high or very low in value (ie: positions, coordinates, etc)
| Float4
* '''Half:''' Medium precision, in most cases is as good as '''Float''' but at half of it's precision
| Float
|-
| Default Value || This is the value the shader currently holds. It's also the default value that is used when a new material is created with this shader.  
| 0
|}
|}




[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List]]
[[Category:Nodes]][[Category:Constants And Properties]]
[[Category:Nodes]][[Category:Matrix Operators]]

Revision as of 16:25, 12 July 2018

Back to Node List

Matrix From Vector Node

The Matrix From Vector node creates and outputs a matrix from vectors specified by its input parameters and size specified by its Output Type.


Nodes used: Vertex Normal, Vertex Tangent, Cross, Matrix From Vectors, Vertex Position, Multiply

Node Parameter Description Default Value
Output Type Specifies the size of the matrix to be created and outputted
  • Matrix3x3: Creates a 3x3 matrix from three float3 vectors specified by the node input
  • Matrix4x4: Creates a 4x4 matrix from four float4 vectors specified by the node input
Matrix3x3
Input to Row Specifies if input vectors are matrix rows or columns. true
[0] Vector to be placed at the matrix first row/column. Only visible if the respective input port is not connected. 0,0,0
[1] Vector to be placed at the matrix second row/column.. Only visible if the respective input port is not connected. 0,0,0
[2] Vector to be placed at the matrix third row/column. Only visible if the respective input port is not connected. 0,0,0
[3] Vector to be placed at the matrix fourth row/column. Only visible if the respective input port is not connected and Output Type is Matrix4x4. 0,0,0,0
Input Port Description Type
[0] Vector to be placed at the matrix first row/column. Float3/Float4
[1] Vector to be placed at the matrix second row/column. Float3/Float4
[2] Vector to be placed at the matrix third row/column. Float3/Float4
[3] Vector to be placed at the matrix fourth row/column. Only available when Output Type is Matrix4x4. Float4


Back to Node List