smooth out the transition from the background layer
This is a bit of a hack but it helps a lot -- for some reason the background layer often has a sharp transition to the in-focus plane and because we're calculating the DoF at 1/4 resolution these transitions are quite visible. We work around this by fading out the transition over a 1 CoC unit, specifically between a CoC of 2 to 1 pixel. Below 1 pixel, we currently clamp to 0.
This commit is contained in:
committed by
Mathias Agopian
parent
ea057ca754
commit
377f043ded
@@ -529,6 +529,11 @@ void postProcess(inout PostProcessInputs postProcess) {
|
||||
|
||||
background = prev.c;
|
||||
bgOpacity = cocToAlpha(prev.coc);
|
||||
#if defined(TARGET_MOBILE)
|
||||
bgOpacity *= saturate((kernelSize - MAX_IN_FOCUS_COC) / (2.0 - MAX_IN_FOCUS_COC));
|
||||
#else
|
||||
bgOpacity *= smoothstep(MAX_IN_FOCUS_COC, 2.0, kernelSize);
|
||||
#endif
|
||||
|
||||
if (prev.cw < MEDIUMP_FLT_MIN) {
|
||||
background *= 0.0;
|
||||
|
||||
Reference in New Issue
Block a user