1 – Installation1. Open AmplifyshaderEditor###.unitypackage
2. After Unity loads it will display the “Importing package” window, select All and click Import
3. Amplify Shader Editor should now be installed in your Unity project and it should have the following directory structure:
2 – The Editor
Open the Amplify Shader Editor canvas, dock it, use it in a separate window, or even another monitor. The editor opens automatically when you double-click an ASE material or shader.
ASE shaders can be created directly in the Project tab or via the Menu under Assets > Create > shaders > Amplify Surface shader.
1. Double-click an ASE shader to open it in the ASE canvas. Alternatively, you can open the shader directly in its inspector tab by clicking on the Open in Shader Editor button.
2. Name your shader directly in the Node Properties tab, you can add your own category by using a forward slash (/) separator. Keep in mind that shader file names are unique and have to be set manually in the Project Explorer tab. You can use different names for the file and actual shader.
3. This area shows the current shader, clicking it will locate and select the shader in the Project Explorer tab. Notice the green outline, it’s a visual aid that lets you know that only the shader is currently open.
1. Double-click a material that uses an ASE shader to open both the shader and the material in the ASE canvas. Alternatively, you can open it directly in the material inspector tab by clicking on the Open in Shader Editor button.
2. By opening the material, both the active shader and material are shown in the lower canvas area. As with the shader, clicking on it will locate and select the material in the Project Explorer tab. Notice the blue outline, it’s a visual aid that lets your know that both the shader and material are currently open.
3 – Canvas UI Interaction
1. Node properties can be adjusted in the left tab. Select a node, or the Master Node, to reveal its parameters. Some values can be adjusted directly in the actual node. Master Node properties are always shown on this tab if no node or multiple nodes are selected. The Master Node Properties tab can be minimized by clicking the minus button in the upper right corner of the tab.
2. Minimalist Save/Update/Clear/Edit buttons. Gray when unavailable or disabled, green when up-to-date, yellow when outdated.
Button 1: Manual shader update (Save and Update)3. Shader category and name.
Button 2: Toggle LIVE shader update (Save and Update Automatically)
Button 3: Remove disconnected nodes
Button 4: Open shader in Text Editor
4. Canvas view adjustment.
Button 1: Select and focus on the Master Node
Button 2: Focus on selected nodes, will focus on the entire node collection if nothing is selected. Automatic zoom is also done by double clicking the button or double pressing the ‘F’ key
5. The Node Palette tab is a searchable node list where you can select and drag out nodes directly onto the canvas area. The Node Palette tab can be minimized by clicking the minus button in the upper left corner of the tab.
6. Right-click anywhere on the canvas to bring up the a simpler searchable node list, click on the node name to create it.
7. Hold a shortcut key and click anywhere on the canvas to create a new node. Shortcut keys are shown inside [ ] placed in front of their respective node names on the Palette Tab. For example: Key ‘1’ for a Float and Key ‘5’ for a Color node.
Data flows from left to right – Input Port > Processed Data > Output Port. Only nodes directly or indirectly connected to a Master Node are analyzed and used to generate the final shader instructions. If a node contains unconnected Input Ports, ASE will use internal data during the processing phase. Internal data values can be edited via the Node Property tab.
Nodes can be selected by either left mouse clicking on them or left mouse drag a box selection over them. Nodes can be appended or removed from a selection by holding the ‘Shift’ key and clicking on it. Press ‘CTRL/CMD+A’ to select everything. Deselect everything by left mouse clicking over an empty space on the node canvas. Move selected nodes by holding your left mouse button over them and dragging.
Delete a wire by holding the ‘Alt’ key and clicking on a node port or drag a connection to an empty canvas space and left click. Wires connected to selected nodes are highlighted to denote data flow, from the leftmost node to the rightmost node.
Create connection by left clicking and dragging a wire either from an output port into an input or from an empty input port to an output port. Left mouse holding on a already connected input port removes wire ending from it and locks it to the mouse cursor so you can drag it to another port. Drag a wire onto an empty canvas space and the context menu automatically appears and if a node type is selected a connection is made with the first valid port.
Output ports can be connected to multiple input ports but input ports accept a single input. Wires automatically snap to ports near the mouse cursor. For easier use, the active port area is quite forgiving, you can even drop your wires directly onto the port name.
Right mouse or middle mouse button drag to pan the view. The canvas will scroll automatically when box selecting or moving selected nodes away from the visible workspace area. You can Zoom In/Out via the mouse scroll wheel. The amount of zoom out is dynamically determined from the nodes positioning on the canvas.
Both the Node Properties and Node Palette windows are automatically minimized when reducing the ASE window width below a value of 750px. You can always maximize them by clicking the rectangular button.
4 – Material and Shader Mode
Warning – The Opacity Mask, Per-Vertex Data and Custom Light Model input ports of the Master Node are currently disabled. They should be available in the next couple of updates.
You can work with ASE in one of two modes, shader or material, depending if you load the shader file from a shader or a material asset. The canvas border serves as a visual indicator of the active mode, a green outline is shown for the shader mode and a blue outline for the material mode.
Values set in a shader are commonly referred to as Default Values. Any changes made to the Default Values of any given shader will automatically affect all materials using it. When simultaneously editing a material and shader, pay close attention to which values are being altered.
Unlike the Default Values in a shader, material values can be unique. material values are only shown when working in the material mode ( with both material and shader opened ). Only nodes which represent variables ( Color, Float, Int, Vector, Matrix ) have a Parameter Type dropdown and can be set to Property. Default values are always copied to material values when selecting Property or Uniform parameter type. Each material can be adjusted in order to create an unlimited number of variations, while still using the same shader. You can think of your materials as instances of your shader, each instance is unique but created using the same set of Default Values.
You can Copy and Paste property values between materials using the same ASE shader. The Open in Shader Editor button provides a quick way to open both the material and shader used in the Amplify Shader Editor.
Shaders can also be opened directly via their inspector tab by clicking on the Open in Shader Editor button. Alternatively, click on Open in Text Editor to open it in your current code editor.
5 – Available Nodes
Looking for a specific node? Search here!
Master nodes are always automatically created and there can be only one per-shader. Special Commentary areas can be created by hitting the ‘C’ key. If a Commentary node is created with nodes currently selected then it will automatically adjust to contain all of them. You can at any time resize a commentary area. To remove a node from a commentary just drag it outside its area. These areas are not analyzed and are only to group up nodes and add notes to that group.
Nodes Definition Clip Planes Camera World Clip Planes Ortho Params Orthographic Parameters Projection Matrices Camera's Projection/Inverse Projection matrix Projection Params Projection Near/Far parameters Screen Params Camera's Render Target size parameters World Space Camera Pos World Space Camera position Z-Buffer Params Linearized Z buffer values Nodes Definition Color [ 5 ] Color property Float [ 1 ] Float property Int [ 0 ] Int property Matrix3X3 Matrix3X3 property Matrix4X4 Matrix4X4 property PI PI constant : 3.14159265359 Vector2 [ 2 ] Vector2 property Vector3 [ 3 ] Vector3 property Vector4 [ 4 ] Vector4 property Nodes Definition Fog and Ambient Colors Fog and Ambient colors Fog Params Parameters for fog calculation Nodes Definition Object Space Light Dir Computes object space direction (not normalized) to light, given object space vertex position World Space Light Dir Computes world space direction (not normalized) to light, given object space vertex position Nodes Definition Decode Float RG Decodes a previously-encoded RG float Decode Float RGBA Encodes [0..1] range float into RGBA color, for storage in low precision render target Decode Lightmap Decodes color from Unity lightmap (RGBM or dLDR depending on platform) Decode View Normal Stereo Decodes view space normal from enc4.xy Encode Float RG Encodes [0..1] range float into a float2 Encode Float RGBA Encodes [0..1] range float into RGBA color, for storage in low precision render target Encode View Normal Stereo Encodes view space normal into two numbers in 0..1 range Luminance Converts color to luminance (grayscale) Object Space View Dir Object space direction (not normalized) from given object space vertex position towards the camera Parallax Offset Calculates UV offset for parallax normal mapping World Space View Dir World space direction (not normalized) from given object space vertex position towards the camera Nodes Definition Blend Operations Common layer blending modes Posterize Converts a continuous gradation of tones to multiple regions of fewer tones Simple Contrast Simple contrast matrix multiplication Simplex Noise Noise generated via the Simplex algorithm Nodes Definition Light Color Light Color World Space Light Pos Light Position Nodes Definition Determinant Scalar determinant of a square matrix Inverse Inverse matrix of a matrix Transpose Transpose matrix of a matrix Nodes Definition Append Append channels to create a new component Break To Components Break a data connection into its components Component Mask Mask certain channels from vectors/color components Position from Transform Gets the poition vector from a transformation matrix Nodes Definition Abs Absolute value of scalars and vectors Add [ A ] Simple add of two variables Ceil Smallest integer not less than a scalar or each vector component Clamp Value clamped to the range [min,max] Ddx Approximate partial derivative with respect to window-space X Ddy Approximate partial derivative with respect to window-space Y Distance Euclidean distance between two points Divide [ D ] Simple divide of two variables Exp Base-e exponential of scalars and vectors Exp2 Base-2 exponential of scalars and vectors Floor Largest integer not greater than a scalar or each vector component Fmod Remainder of x/y with the same sign as x Fract Fractional portion of a scalar or each vector component Length Scalar Euclidean length of a vector Lerp [ L ] Linear interpolation of two scalars or vectors based on a weight Log Natural logarithm of scalars and vectors Log10 Base-10 logarithm of scalars and vectors Log2 Base-2 logarithm of scalars and vectors Max Simple Maximum of two scalars or each respective component of two vectors Min Simple Minimum of two scalars or each respective component of two vectors Multiply [ M ] Simple multiplication of two variables One Minus [ O ] 1 - input value Power [ E ] A to the b-th power of scalars and vectors Remainder Remainder between two variables Round Rounded value of scalars or vectors Rsqrt Reciprocal square root of scalars and vectors Saturate Smallest integer not less than a scalar or each vector component Scale Scales input by a float factor Sign Sign of scalar or each vector component Smoothstep Interpolate smoothly between two input values based on a third Sqrt Square root of scalars and vectors Step Step function returning either zero or one Subtract [ S ] Simple subtraction of two variables Trunc Largest integer not greater than a scalar or each vector component Nodes Definition Compute Grab Screen Pos Computes texture coordinate for doing a screenspace-mapped texture sample. Input is clip space position Compute Screen Pos Computes texture coordinate for doing a screenspace-mapped texture sample. Input is clip space position Nodes Definition Color Interpolated per-vertex color Local Vertex Pos Interpolated Vertex Position in Local Space Per Pixel World Reflection Vector [ R ] Per pixel world reflection vector Pixel Normal World Per pixel world normal vector Screen Position Screen space position Texture Coordinates [ U ] Texture UV coordinates set Vertex Normal World Vertex Normal World View Dir View direction vector World Position World space position World Reflection World reflection vector Nodes Definition Blend Normals Blend Normals Panner Pans UV texture coordinates according to its inputs Texture Sample [ T ] Textures Unpack Scale Normal Applies UnpackNormal/UnpackScaleNormal function Nodes Definition Cos Time Cosine of time Delta Time Delta time Sin Time Unity sin time Time Parameters Time since level load Nodes Definition Common Transform Matrices All Transformation types Inverse Transpose Model View All Transformation types Model View Current model * view matrix Model View Projection Current model * view * projection matrix Object to World Current model matrix Projection Matrix Current projection matrix Scale Matrix Scale Matrix Texture 0 Matrix Texture 0 Matrix Texture 1 Matrix Texture 1 Matrix Texture 2 Matrix Texture 2 Matrix Texture 3 Matrix Texture 3 Matrix Transpose Model View Transpose of model * view matrix View All Transformation types View Projection Current view * projection matrix. World to Object Inverse of current world matrix Nodes Definition ACos Arccosine of scalars and vectors ASin Arcsine of scalars and vectors ATan Arctangent of scalars and vectors ATan2 Arctangent of y/x Cos Cosine of scalars and vectors Cosh Hyperbolic cosine of scalars and vectors Degrees Converts values of scalars and vectors from radians to degrees Radians Converts values of scalars and vectors from degrees to radians Sin Sine of scalars and vectors Sinh Hyperbolic sine of scalars and vectors Tan Tangent of scalars and vectors Tanh Hyperbolic tangent of scalars and vectors Nodes Definition LOD Fade LODFadeNode Nodes Definition Cross Cross product of two three-component vectors Dot Scalar dot product of two vectors Normalize [ N ] Normalizes a vector Reflect Reflection vector given an incidence vector and a normal vector Refract Computes a refraction vector Nodes Definition [VS] Vertex Color Vertex color. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ). [VS] Vertex Normal Vertex Normal. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ). [VS] Vertex Pos Vertex position. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ). [VS] Vertex Tangent Vertex tangent vector. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ). [VS] Vertex TexCoord Vertex texture coordinates. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ). [VS] Vertex TexCoord1 Second set of vertex texture coordinates. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ). Vertex Color on Frag Vertex color interpolated on fragment Nodes Definition Object To Clip Pos Transforms a point from object space to the camera’s clip space in homogeneous coordinates Object To View Pos Transforms a point from object space to view space Nodes Definition Shade Vertex Lights Computes illumination from four per-vertex lights and ambient, given object space position & normal
6 – Your First shader
1. Open the Editor, create a new material and a new shader in the Project Explorer tab. In the newly created material, select your new shader and click on the Open in Shader Editor button to open both the shader and material.
2. As an example, select the Master Node and change its Light Model to specular.
3. Right click on the canvas to open the searchable node list and type “Lerp”. Click on Lerp and connect the node Output Port to the Albedo Input Port.
4. Hold the 5 shortcut key and click on the canvas to create a new Color node. Alternatively, you can use the searchable list used early or drag and drop the node from the Node Palette on the right side; Constants > Color [ 5 ].
5. Select the new Color node and hit ‘CTRL/CMD+D’ to duplicate it. Connect both nodes to the Lerp Input Ports. Set the first node to gray and the second one to a more lively color.
6. Create a Float node by dragging and dropping it from the Node Palette, connect it to the Alpha port of the Lerp node. In the node properties of the newly created float, set its Minimum value to 0 and Maximum to 1. Notice that the Float can now be controlled by a Slider. Don’t forget to set its Parameter Type to Property, this way you will be able to change it directly in the material. You can also name the node and change its position in the material inspector by adjusting the Index value. As an example, lets name it Color Mix.
7. Create a new Float and connect it to the Smoothness Input Port of the Master Node, set its Minimum value to 0 and Maximum to 1 as you did before. Set its type to Property and name it Smoothness Value. Create another Float and connect it to the Specular Input Port, set its Minimum value to 0 and Maximum to 1. Set its Type to Property and name it Specular Value.
8. To conclude, Drag and Drop a Normal Map texture from your Project Explorer directly into the canvas. As an example, we used a Brushed Metal texture. Connect it to the Normal Input Port of the Master Node and you are done. You have just built your first shader, don’t forget to save your work regularly by clicking the Update button located in the upper left corner. Alternatively, you could edit the shader with the LIVE mode enabled, any change are immediately saved and updated. Depending on the complexity of the shader, the LIVE mode may take a second or so to update. Contrary to Default shader values, any changes made to a material property are immediately visible.
- Unreal Engine