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:
authorAntony Riakiotakis <kalast@gmail.com>2015-02-17 20:08:28 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-17 20:11:22 +0300
commitff7220349d32e747c7559809d68de7d835c0c1cd (patch)
treec6955f0b86bcf12ab6dc5d87b4a48300375d3da3 /source/blender/gpu/shaders
parenta0d7db503d82c1a5b56a5723da90364f11569b37 (diff)
Compositing works with X-Ray.
Basically, before drawing X-Rays, we now bind a second depth buffer. After drawing XRays, we do an extra resolve pass where we overwrite the non-XRay depth buffer in pixels where the depth is not maximum (which means background pixel, since depth is cleared before drawing X-Ray objects). This ensures both scene and X-Rays keep their depth values and are ready for compositing. Well, the odd effect due to depth discontinuities can be expected, and X-Rays are a bit more expensive (extra buffer + resolve pass) but at least X-Rays won't invalidate depth values anymore. Whee!
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl b/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl
new file mode 100644
index 00000000000..e04cd7d3306
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl
@@ -0,0 +1,14 @@
+uniform sampler2D depthbuffer;
+varying vec4 uvcoordsvar;
+
+void main(void)
+{
+ float depth = texture2D(depthbuffer, uvcoordsvar.xy).r;
+
+ /* XRay background, discard */
+ if (depth >= 1.0) {
+ discard;
+ }
+
+ gl_FragDepth = depth;
+}