I evaluated the issue T79060 where the user had reported banding in semi-transparent pixels when using the hardlight blend mode and have found this issue to present in all multiplicative blend modes. It can only be visually seen in Multiply and Hardlight but divide is also blended in a similar fashion.
Solution
The geometry pass is already pre-multiplied with the alpha, therefore the multiplication with the alpha in the layer blend pass is not needed. This extra alpha multiplication is present in ALL blend modes so all blend modes need correcting.
The hardlight blend mode has been corrected and rewritten for clarity.
Additionally mask/opacity should be premultiplied with the geometry pass before applying any blend mode.
Further Work
- Do some further tests, by comparing the GPencil layer blending results with the layers composited in Benders compositor. This will ensure the results are consistent throughout.
- Double check if the max test is needed on the frag_revealage in the second pass of HardLight blend mode.
- Removed unnecessary variable name changes in Hardlight blend mode to keep the style consistent throughout the rendering code.
- Add mask pass to the uploaded diagram to make it clear that it is used in the layer blending pass.
This will likely need versioning if accepted. Any files that use blend modes with semi-transparent textures will change in appearance with this patch.
