Various fixes for transmittance effect#93448
Conversation
Use correct shadow sampling for omni and spot lights Disable transmittance if shadows are disabled Correct DirectionalLight transmittance bias to match shadow bias (its still pretty sensitive though)
BastiaanOlij
left a comment
There was a problem hiding this comment.
LGTM, I'm not too familiar with the transmittance code so purely judging on code style.
Only question I have seeing you mention in your description that transmittance requires shadows to be enabled, why you're not doing a #if defined(LIGHT_TRANSMITTANCE_USED) && !defined(SHADOWS_DISABLED) and skip over the code entirely?
Just because the first couple variables are still needed for the light compute function: So the defines are slightly separated, but in practice it should be fine |
|
Thanks! |
|
Cherry-picked for 4.3.1. |
Fixes: #88083
Fixes: #73946
Use correct shadow sampling for omni and spot lights. We changed how shadow maps were sampled in #51335, but we forgot to update the code for transmittance, so it was sampling from the totally wrong position. This resulted in the bug reported in #88083
Disable transmittance if shadows are disabled. Transmittance requires reading from the shadow map. It used to be calculated at the same time as shadows but was moved in #45023. It has been broken ever since. I noticed this while working on something unrelated.
Correct DirectionalLight transmittance bias to match shadow bias (its still pretty sensitive though). The calculation of bias was updated in #51025 but it wasn't updated for Transmittance. The result is that the default bias is way too large. Users need to manually adjust bias to a tiny amount for it to work at all.
before

after
