Differential D16243 Diff 58431 source/blender/draw/engines/eevee/shaders/effect_dof_reduce_frag.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/effect_dof_reduce_frag.glsl
| /** | /** | ||||
| * Reduce pass: Downsample the color buffer to generate mipmaps. | * Reduce pass: Downsample the color buffer to generate mipmaps. | ||||
| * Also decide if a pixel is to be convolved by scattering or gathering during the first pass. | * Also decide if a pixel is to be convolved by scattering or gathering during the first pass. | ||||
| */ | */ | ||||
| #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) | #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) | ||||
| /** Inputs: | |||||
| * COPY_PASS: Is output of setup pass (halfres) and downsample pass (quarter res). | |||||
| * REDUCE_PASS: Is previous Gather input miplvl (halfres >> miplvl). | |||||
| */ | |||||
| uniform sampler2D colorBuffer; | |||||
| uniform sampler2D cocBuffer; | |||||
| uniform sampler2D downsampledBuffer; | |||||
| uniform vec2 bokehAnisotropy; | |||||
| uniform float scatterColorThreshold; | |||||
| uniform float scatterCocThreshold; | |||||
| uniform float scatterColorNeighborMax; | |||||
| uniform float colorNeighborClamping; | |||||
| /** Outputs: | |||||
| * COPY_PASS: Gather input mip0. | |||||
| * REDUCE_PASS: Is next Gather input miplvl (halfres >> miplvl). | |||||
| */ | |||||
| layout(location = 0) out vec4 outColor; | |||||
| layout(location = 1) out float outCoc; | |||||
| #ifdef COPY_PASS | #ifdef COPY_PASS | ||||
| layout(location = 2) out vec3 outScatterColor; | |||||
| /* NOTE: Do not compare alpha as it is not scattered by the scatter pass. */ | /* NOTE: Do not compare alpha as it is not scattered by the scatter pass. */ | ||||
| float dof_scatter_neighborhood_rejection(vec3 color) | float dof_scatter_neighborhood_rejection(vec3 color) | ||||
| { | { | ||||
| color = min(vec3(scatterColorNeighborMax), color); | color = min(vec3(scatterColorNeighborMax), color); | ||||
| float validity = 0.0; | float validity = 0.0; | ||||
| /* Centered in the middle of 4 quarter res texel. */ | /* Centered in the middle of 4 quarter res texel. */ | ||||
| ▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines | |||||