SDF as alpha SparkAR

ok question, can I use an SDF as an alpha? Like I have a vector 4 pack patch but when I plug my sdf in the fourth slot it gets mad (I know I’m missing something simple). Are there some patches I’m missing here?

(Depending on the how your patch graph looks like) SDFs are a usually single channel (you can ensure this using Swizzle “x”).

If you want to pack your SDF as alpha (assuming it’s a single channel) for an RGB texture, you need to use pack2. You can think of this as packing two things together, the 3 RGB channels, and the extra 1 SDF mask channel; this is of course, exactly backwards to how pack works in GLSL, and even SparkSL :smiley:

1 Like

So I was struggling with pack2 or even4 because the input had too much data (I’m also changing the position of the sdf). Totally forgot the mix patch exists!!! Got it to work that way lol oof @Tomas_Pietravallo

1 Like