overte/interface/resources/shaders/occlusion_blur.frag
Andrzej Kapolka 22598ceb4f Optimizations for occlusion blur (the main one being that we only need to
sample the texture four, not sixteen, times if we turn on linear filtering
and sample between the texels).
2013-08-20 11:52:43 -07:00

24 lines
714 B
GLSL

#version 120
//
// occlusion_blur.frag
// fragment shader
//
// Created by Andrzej Kapolka on 8/16/13.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
// the original texture
uniform sampler2D originalTexture;
// the scale for the blur kernel
uniform vec2 blurScale;
void main(void) {
vec2 minExtents = gl_TexCoord[0].st + blurScale * vec2(-0.5, -0.5);
vec2 maxExtents = gl_TexCoord[0].st + blurScale * vec2(1.5, 1.5);
gl_FragColor = (texture2D(originalTexture, minExtents) +
texture2D(originalTexture, vec2(maxExtents.s, minExtents.t)) +
texture2D(originalTexture, vec2(minExtents.s, maxExtents.t)) +
texture2D(originalTexture, maxExtents)) * 0.25;
}