0
\$\begingroup\$

I am playing a bit with the shader graph (I am fairly new to shaders) but I am completely lost at the moment.

What I'd like to obtain is to somehow retrieve the alpha value after the blended operation is made, and use that value.

More specifically: if, for example, I have multiple white sprites with alpha 0.5, I'd like to see the alpha blended normally, but with the color representing the alpha value "after the blend," as shown in this image:

mockup

While I see how to use the Lerp to convert a possible 0-1 value to color, I am lost at how to retrieve the values used in the blending operation (possibly in the shader graph, if that's even possible?)

\$\endgroup\$
2
  • \$\begingroup\$ This would be a two-step process: 1) render your overlapping sprites to a RenderTexture, so you get a greyscale image similar to what you have on the left. 2) render a quad with that texture, and in the shader, colourize the result. Can you tell us a bit more about what you're trying to achieve with this effect? There may be simpler means to that end. \$\endgroup\$ Commented Jul 7, 2022 at 17:09
  • \$\begingroup\$ Thanks a lot for your reply! I really appreciate It does make sense and seems a bit simpler then my initial thought! I was wondering whether it was possible not to have an extra quad (i thought there could've been a way to 'override' the default alpha calculation) - my plan is to make a 'radar' with a heatmap representing the density of signal in each point (so red=a lot of stuff going on, green=not as many things) hope I've been half clear on the explanation! \$\endgroup\$ Commented Jul 7, 2022 at 22:32

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.