Page MenuHome

Grease Pencil: Add holdout layer blend mode
AbandonedPublic

Authored by Cody Winchester (CodyWinch) on Apr 17 2020, 4:24 AM.

Details

Summary

This patch aims to add a Holdout blend mode for grease pencil layers. It functions as a subtract blend mode that is transparent itself.

Diff Detail

Repository
rB Blender

Event Timeline

Cody Winchester (CodyWinch) requested review of this revision.Apr 17 2020, 4:24 AM
Cody Winchester (CodyWinch) created this revision.

It functions as a subtract blend mode that is transparent itself.

Holdout is not a subtract blend mode. It's a mix between the destination color and zero, with the source alpha as the mix factor.

Which boils down to dst.rgba = dst.rgba * (1 - src.a).

source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
139

This does nothing, it's modifying an input parameter.

140

Missing break.

It functions as a subtract blend mode that is transparent itself.

Holdout is not a subtract blend mode. It's a mix between the destination color and zero, with the source alpha as the mix factor.

Which boils down to dst.rgba = dst.rgba * (1 - src.a).

Seems you are right. I meant that I thought what I was doing is the same thing as the subtract blend mode but setting the source subtract layer to an alpha of 0.0.

I believe that this may not actually be needed now. In the past I had issues where a subtract layer would show as black instead of transparent and lowering the opacity would remove the subtraction. But it is possible to set a subtract layer to an opacity of 0.0 and have it render transparent and still subtract the other layers.