Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/effect_dof_setup_frag.glsl
| /** | /** | ||||
| * Setup pass: CoC and luma aware downsample to half resolution of the input scene color buffer. | * Setup pass: CoC and luma aware downsample to half resolution of the input scene color buffer. | ||||
| * | * | ||||
| * An addition to the downsample CoC, we output the maximum slight out of focus CoC to be | * An addition to the downsample CoC, we output the maximum slight out of focus CoC to be | ||||
| * sure we don't miss a pixel. | * sure we don't miss a pixel. | ||||
| */ | */ | ||||
| #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) | #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) | ||||
| /* Full resolution. */ | |||||
| uniform sampler2D colorBuffer; | |||||
| uniform sampler2D depthBuffer; | |||||
| uniform float bokehMaxSize; | |||||
| /* Half resolution. */ | |||||
| layout(location = 0) out vec4 outColor; | |||||
| layout(location = 1) out vec2 outCoc; /* x: Downsample CoC, y: Max slight focus abs CoC */ | |||||
| void main() | void main() | ||||
| { | { | ||||
| vec2 fullres_texel_size = 1.0 / vec2(textureSize(colorBuffer, 0).xy); | vec2 fullres_texel_size = 1.0 / vec2(textureSize(colorBuffer, 0).xy); | ||||
| /* Center uv around the 4 fullres pixels. */ | /* Center uv around the 4 fullres pixels. */ | ||||
| vec2 quad_center = (floor(gl_FragCoord.xy) * 2.0 + 1.0) * fullres_texel_size; | vec2 quad_center = (floor(gl_FragCoord.xy) * 2.0 + 1.0) * fullres_texel_size; | ||||
| vec4 colors[4]; | vec4 colors[4]; | ||||
| vec4 depths; | vec4 depths; | ||||
| Show All 37 Lines | |||||