I’m trying to create a sun disk with a halo in the same shader. However, mixing the two shaders has been a failure. At the edge of the sun disk, where the opacity decreases gradually, we can see the background behind the sun halo in red. Yet, that part of the halo at that position is completely opaque. I know the cause of the problem, but I don’t figure out a solution to replace any transparent value from the sun disk by the value of the halo. It appears that blending the two shaders that way takes a part of the opacity from the sun disk and blends it with the background instead of replacing it with the other shader.
Here’s the shader below for the problematic version.
Here are two renders. The first one is the problematic version with the shader mentioned above. The second version is the desired result. I can get the desired result if I create two planes close to each other. I have to use the halo shader alone on the plane behind and the sun disk shader alone on the plane at the front.
The goal is to reproduce the same blending process with opacity, but in the same shader (or material).
I placed a checker board behind the sun in the render test to clarify the problem at the edge of the sun disk.
How would you mix the two shaders in one material to achieve the result of the second screenshot? In other words, to replicate the same result as the blend result of two planes with transparency.