Skip to main content
Version: 5.x

Nodes > Main > Pack

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

NameTypeDescription
ValuefloatValue to pack
MinfloatLower bound for first input value
MaxfloatUpper bound for first input value
Value 2floatSecond value to pack
Min 2floatLower bound for second input value
Max 2floatUpper bound for second input value

Outputs

NameTypeDescription
Value ( Packed )floatVector containing the packed value(s)

Properties

NameTypeDescription
ModedropdownControls 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 RangestringThis uneditable field shows the decimal precision of the packing algorithm, useful to know for special cases such as integrating packed values with script.
Was this page helpful?
Yes
No