This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl
Antonis Ryakiotakis ff7220349d 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!
2015-02-17 18:11:22 +01:00

15 lines
227 B
GLSL

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;
}