Skip to content

Commit

Permalink
Update convolution.bokeh.frag
Browse files Browse the repository at this point in the history
  • Loading branch information
vanruesc committed Sep 18, 2023
1 parent f8fb977 commit e60fe0e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/materials/glsl/convolution.bokeh.frag
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ void main() {

#ifdef FOREGROUND

vec2 CoCNearFar = texture2D(cocBuffer, vUv).rg;
float CoC = CoCNearFar.r * scale;
vec2 cocNearFar = texture2D(cocBuffer, vUv).rg * scale;
float coc = cocNearFar.x;

#else

float CoC = texture2D(cocBuffer, vUv).g * scale;
float coc = texture2D(cocBuffer, vUv).g * scale;

#endif

if(CoC == 0.0) {
if(coc == 0.0) {

// Skip blurring.
gl_FragColor = texture2D(inputBuffer, vUv);
Expand All @@ -47,11 +47,11 @@ void main() {
#ifdef FOREGROUND

// Use far CoC to avoid weak blurring around foreground objects.
vec2 step = texelSize * max(CoC, CoCNearFar.g * scale);
vec2 step = texelSize * max(cocNearFar.x, cocNearFar.y);

#else

vec2 step = texelSize * CoC;
vec2 step = texelSize * coc;

#endif

Expand Down

0 comments on commit e60fe0e

Please sign in to comment.