Nodes > Main > Pack
Stores one or more floating point values as a single vector of 8 bit values. The input value(s) are converted to the 0-1 range based on the corresponding Min and Max values, then split into multiple 8 bit chunks (depending on the selected Mode) and output as a vector. This vector can be converted back to the original floating point number using an Unpack node with matching settings.
This node is useful for passing high precision values from one material to another through a render target. For example, one material could calculate precise height values every frame, and use a Pack node to pack each height as a 32 bit value that gets rendered out as an RGBA pixel. A second material could read this output in through a Render Target texture, and use the Unpack node to convert from RGBA back to floating point.
Note that packing values can cause a slight loss in precision, depending on the input value and Mode being used.
Inputs
Name | Type | Description |
---|---|---|
Value | float | Value to pack |
Min | float | Lower bound for first input value |
Max | float | Upper bound for first input value |
Value 2 | float | Second value to pack |
Min 2 | float | Lower bound for second input value |
Max 2 | float | Upper bound for second input value |
Outputs
Name | Type | Description |
---|---|---|
Value ( Packed ) | float | Vector containing the packed value(s) |
Properties
Name | Type | Description |
---|---|---|
Mode | dropdown | Controls how many values will be packed, and how many bits will be used for each value. The more bits, the more channels will be used in the output vector. Every 8 bits adds an extra channel to the output. |
Remap Range | string | This uneditable field shows the decimal precision of the packing algorithm, useful to know for special cases such as integrating packed values with script. |