Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-05-10 16:58:18 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-05-10 17:03:25 +0300
commit45207bf3ce96f008496caf1be8166fd09065c4a0 (patch)
tree2cac0276dd3aa7cd97e6619ba66f9889d1c88a85 /source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
parentfdf2d8bb9592bd3a650b35d8bbd8a633169ac026 (diff)
Eevee: Post process parameters.
-Display almost all parameters. -Made some small adjustment to motion blur to support FOV motion blur. -Made DOF max radius a parameter.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
index e603769c9c8..8960b339a61 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
@@ -2,7 +2,6 @@
uniform sampler2D colorBuffer;
uniform sampler2D depthBuffer;
-uniform float blurAmount;
/* current frame */
uniform mat4 currInvViewProjMatrix;
@@ -14,7 +13,9 @@ in vec4 uvcoordsvar;
out vec4 FragColor;
-#define MAX_SAMPLE 16
+#define MAX_SAMPLE 64
+
+uniform int samples;
float wang_hash_noise(uint s)
{
@@ -37,7 +38,8 @@ void main()
ndc_pos.xy = uvcoordsvar.xy;
ndc_pos.z = texture(depthBuffer, uvcoordsvar.xy).x;
- float noise = 2.0 * wang_hash_noise(0u) / MAX_SAMPLE;
+ float inv_samples = 1.0 / float(samples);
+ float noise = 2.0 * wang_hash_noise(0u) * inv_samples;
/* Normalize Device Coordinates are [-1, +1]. */
ndc_pos = ndc_pos * 2.0 - 1.0;
@@ -50,10 +52,12 @@ void main()
vec4 old_ndc = pastViewProjMatrix * vec4(world_pos, 1.0);
old_ndc.xyz /= old_ndc.w; /* Perspective divide */
- vec2 motion = (ndc_pos.xy - old_ndc.xy) * blurAmount;
+ vec2 motion = (ndc_pos.xy - old_ndc.xy) * 0.25; /* 0.25 fit cycles ref */
- const float inc = 2.0 / MAX_SAMPLE;
- for (float i = -1.0 + noise; i < 1.0; i += inc) {
- FragColor += texture(colorBuffer, uvcoordsvar.xy + motion * i) / MAX_SAMPLE;
+ float inc = 2.0 * inv_samples;
+ float i = -1.0 + noise;
+ for (int j = 0; j < samples && j < MAX_SAMPLE; j++) {
+ FragColor += texture(colorBuffer, uvcoordsvar.xy + motion * i) * inv_samples;
+ i += inc;
}
}