Implementation of PCSS in ShadowGenerator

Currently, there’s a special code path for PCF that:

  • disable writing to the color buffer (engine.setColorWrite(false);)
  • does not clear the color buffer (engine.clear(clearOne, false, true, false); => it’s the first false that does not clear the color buffer)

PCSS is different, it does not disable writing to the color buffer and does clear the color buffer.

However, as I understand it, PCSS algorithm does not use the color buffer either, so using the same code path than PCF should work: I tested it, and it seems to work.

Did I miss something or we can also optimize the PCSS case like the PCF one?

If yes, I can submit a PR for that.

Summoning @sebavan (again, sorry dude:))

It does need it and it is why it is enabled. for PCSS you need both the shadow sampler in comparison mode and the raw depth values. As you can not in WebGL2 read both from the same texture simply with different sampler objects, we store the depth in the color hence the need for it.

Yes my bad, I saw it afterwards, sorry for the trouble.