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>2018-01-17 16:02:48 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-01-17 16:02:48 +0300
commit8e35a9e4c7fdeb09c31b7cc52955974748fb22c3 (patch)
tree9b059eb1f7af8363af79d58237e2afc05f1fb9e5 /source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl
parent54e10dbd17febf4873ca70b7da892c673a8b2d93 (diff)
Eevee: Perf: Update noises (in utilTex) via GPU drawing.
This leads to a ~3ms improvement of CPU time during drawing. This prevent the rendering from being stalled waiting for the texture data to be transfered.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl b/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl
new file mode 100644
index 00000000000..13ffe02eb0d
--- /dev/null
+++ b/source/blender/draw/engines/eevee/shaders/update_noise_frag.glsl
@@ -0,0 +1,18 @@
+
+uniform sampler2D blueNoise;
+uniform vec3 offsets;
+
+out vec4 FragColor;
+
+#define M_2PI 6.28318530717958647692
+
+void main(void)
+{
+ vec2 blue_noise = texelFetch(blueNoise, ivec2(gl_FragCoord.xy), 0).xy;
+
+ float noise = fract(blue_noise.y + offsets.z);
+ FragColor.x = fract(blue_noise.x + offsets.x);
+ FragColor.y = fract(blue_noise.y + offsets.y);
+ FragColor.z = cos(noise * M_2PI);
+ FragColor.w = sin(noise * M_2PI);
+}