Question about shader ('Add' vs 'Pack Float2')

I am a complete newbie about all shader things, testing things with material node editor.

What I wanted to make was a simple box fill sprite material, getting a sprite with two colors and a fill value(0 to 1).



With some trial and errors and referring Flax Material Tour examples, I managed to make a material above with following nodes.

But I still cannot understand why Add node (red circle below) is needed instead of ‘Pack Float2’ node, which I thought the answer at the first time.

‘UVs’ input hint popup of Sample Texture node tells me that this is a Float2 value, so I tried to merge a variable of a float and a constant of a float.


But this made the Sampling node to pick only single point of a UV plane, filling the entire output plane with a single color.


What is the difference between ‘Add’ and ‘Pack xxx’?
Isn’t the ‘Add’ node memberwise vector sum?
Why ‘Sample texture’ acts totally different (UV shift vs. point capture and fill) with same(?) Float2 values?

I struggled to track what is the actual input/output value/form of the nodes because it was hard to match the actual behaviours of the value flow with what I supposed reading the document.

Is there some kind of debugger for material editor? I see many graph type shader editors provide somewhat ‘visualizers’ to keep track what is the output of nodes.

This level of feature is could be too big, but I think some kind of probe to point with the mouse at the edge of nodes, telling what type/values are flowing through currently will be a great help.

Keep in mind that in Flax’s Material Nodes

A * B != B * A

Because the node output is cast to the (first?) datatype passed into the node. (I also get confused all the time).

Pack Float2 node accepts 2 floats and packs them into a FLoat2 (Or Vector2) where X is first input and Y second

Add is just an add, but with the catch of the first data type being the output

Add node’s output depends on the first arg, but Pack Float2 node always output as Float2 right?

Yes, but the inputs may be truncated if you provide anything besides 1 dimensional types

Yes, and I was curious that why the Float2 into the UV input samples a single color.

How would you expect it to behave when you input a Float2 output into a Float1 Input?

Sorry I couldn’t understand. Is UV a single Float1? I was thinking that U and V are floats each.

UV is a Float2 but [Pack Float2] node accepts 2x Float1. When you try to pass in Float2 it gets truncated afaik

Yes, I passed two Float1s to the [Pack Float2] input nodes and linked its output (Float2) to the UVs input, as depicted in the screenshot above. Isn’t it?