- Home /
ShaderGraph / Shader URP Cap Alpha Value of Rendered Pixel
I have made a Shader with ShaderGraph and then altered it a bit in HLSL/GLSL. It is only meant to work with spheres. That Shader, along with some other things, has a reversed Fresnel effect on it so that the center of the sphere has an alpha value of 0.5 and the outer edges 0. Since this shader is made to be used for some kind of heatmap visualization, I want the colors of the semitransparent spheres to "mix" where they overlap, which it already does. The picture shows what my current shader does.
The issue: Since there is a 3D map underneath, I do not want the alpha of the Spheres to add to each other when they overlap to a point where the objects underneath are obscured because alpha adds up to 1, like it almost does with the red spot, where there are multiple spheres above each other. I want to technically cap the alpha value of the shader to a maximum of 0.5 of the finally rendered pixel, so it is always see-through by 50%. However, I of course still want the alphas to overlap, just have them capped.
I have tried to use alphatest but it doesn`seem to do anything. Also, I am not sure if it wuld be able to reach my wanted result, because I need to change the postprocessing-alpha value of the pixel as far as I understand it.
Thank you in advance!
Your answer
Follow this Question
Related Questions
Problem with alpha blending on shader Unity 5 2 Answers
How can i add a alpha value to this shader? 1 Answer
Custom shader converting to urp need help 1 Answer
Scene Color Node in Shader Graph not working with Unity's 2D Renderer and URP 5 Answers
Shader with "alpha" parameter no longer writes to Z-Buffer 2 Answers