Unity Products:Amplify Shader Editor/Unpack Scale Normal

From Amplify Creations Wiki
Jump to navigation Jump to search

Back to Node List

Unpack Scale Normal

This node runs Unity's internal function UnpackScaleNormal to unpack normal map textures and scale the normal accordingly. When using a Texture Sample node the normal map is detected and the unpacking happens automatically. If the texture is not marked as a normal map but contains one anyway, the texture then needs to be set in linear space and the shader must do some remapping before this node can use it. This is because Unity's packs Red and Green channels into the Green and Alpha channels respectively when importing normalmaps to increase packing precision which in turn saves diskspace.

The reason you would ever need to use this node and accept the loss in disk space or precision is when you want to use the Alpha and Blue channels of a normal map for something else. (ie: packing a roughness or metallic map with the normal map)

Note: As for Unity 2017 there is also support for RG normal maps( x on red channel and y on green channel ) but unused channels on the normal map must be set to 1.
Please note on the screenshot above that, since swizzled AG format is being used, R must be set to 1 over the Append node.
Be sure to check Unity's official Upgrade Guide and search for New normal map type that support BC5 format for additional information.


Nodes used: Float, Texture Sample, Append, Unpack Scale Normal, Color, Multiply

Node Parameter Description Default Value
Value The value you want to unpack and scale to generate the normal vector. Only shows if the respective input port is not connected. ( 0, 0, 0, 0 )
Normal Scale This scale the normal map perpendicular to the surface. Effectively decreasing or increasing how bumpy the surface looks. Only shows if the respective input port is not connected. 1
Type Sets which transform space is the normal vector supplied over Value
  • Tangent: Normal value set on Value is in tangent space
  • Object: Normal value set on Value is in object/normal space
Tangent


Input Port Description Type
Value The value you want to unpack and scale to generate the normal vector. Float4
Normal Scale This scale the normal map perpendicular to the surface. Effectively decreasing or increasing how bumpy the surface looks. Float
Output Port Description Type
XYZ Returns a normal vector in tangent space Float3
X Returns only the X component of the normal vector Float
Y Returns only the Y component of the normal vector Float
Z Returns only the Z component of the normal vector Float

Back to Node List