Skip to content

A new blending mode do a fake PBR

Shuqi Xiu requested to merge despair/krita:despair/fake_pbr_blending_mode into master

Add blending mode <PBR Light(linear)> for linear color space

layer mock light on albedo, 50% gray --- rgb(0.215686, 0.215686, 0.215686) keep baseColor looks, less than it darker, more than it brighter.


this is the example on Scene Linear Painting doc, left 2 right–> light – base color – result – luminosity


left 2nd is blending mode pbr light result, use left 1st with luminosity adjust as layer content.

Add bleding mode <PBR Light(Gamma2.2)> for Gamma2.2 like sRGB etc..

50% gray --- rgb(0.5,0.5,0.5) keep baseColor looks, less than it darker, more than it brighter.


Principle very simple, do multiply with a coefficient which equal to 1.0f/ (50% grayscale<gamma2.2==0.5 | linear == 0.215686 >) and do hsy addlightness(0)

We need a more appropriate name for the new blending mode

maybe some better algorithm transform color rgb value over 1.0;

Test Plan

Just create a new layer Blending mode->HSY->PBR Light(Linear/Gamma2.2) paint 50%gray will do nothing, higher brighter, lower darker, just mutiply as lambert.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Shuqi Xiu

Merge request reports