Unity Products:Amplify Shader Editor/Custom Expression
Custom Expression Node
The Custom Expression Node allows shader code to be directly injected into the graph. It will either write inline or create a function according to how code is written on its Code text area. If a return function is detected on the text area then a function will be created. Also in function mode each instruction line must end with a ;. If no return function is detected them an expression will be generated and used directly on the vertex/frag body. On Expression mode a ; is not required on the end of an instruction line.
|Node Parameter||Description||Default Value|
|Name||Custom Expression name. It will be used to internally name the variable or function generated.||My Custom Expression|
|Mode|| Determines on how use the code placed over the Code text area.
With Call Mode active, a special input port In is added, which acts as a relay passing what is connected to it directly to the node output port.
|Precision|| Precision used when declaring the node internal variables.
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.
|Code||Text area on which the custom expression or function is written. Creates a function or a custom expression depending if it contains a return statement on its body.||False|
|Set Unique|| If toggled on, a unique id will be appended to the function/variable name. This allows different Custom Expressions to have the same name.
If, for example, a user wants a function to be generated over the Custom Expression and used by others then it should be toggled off in order to maintain the original name.
|Auto-Register||Register functions generated by the Custom Expression even when no connection exists with an output node.||False|
|Output Type||Variable type of the newly created expression or return type of the newly created function. Only visible when Call Mode is turned off.||Float|
|Dependencies||Allows the user to select other Custom Expressions on which it depends on, in order to guarantee they are written first.||-|
|Inputs||Allows adding (+) or removing (-) Input ports. Input ports can be used inside the code area by directly calling their names.||0|
|Qualifier|| Specifies type qualifier for current input parameters on function mode. When on this mode, a function is created with each Input Port set as a function input parameter using its assigned qualifier.
|Type|| Data Type for the input port
|Name||Input name, also used internally as a variable or function parameter name.||In#|
|Value||Input current value. Only visible if the respective input port is not connected.||0|
|In#||The amount and type of input ports is given by the node configuration. Each input port corresponds to the node input parameter with the same name and order at the Node Properties.||Float|