diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp')
| -rw-r--r-- | KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp b/KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp new file mode 100644 index 00000000..eb9db462 --- /dev/null +++ b/KaplaDemo/externalIP/resources/shaders/bloomH_fs.cpp @@ -0,0 +1,24 @@ + uniform sampler2D colorTex; + uniform float sx; + + void main (void) + { + vec3 bloom = vec3(0.0, 0.0, 0.0); + const float hdrScale = 1.5; + const int kernelSize = 10; + const float invScale = 1.0 / (hdrScale * float(kernelSize)); + + for (int x = -kernelSize; x <= kernelSize; x++) + { + float s = gl_TexCoord[0].s + x * sx; + float t = gl_TexCoord[0].t; + vec3 color = texture2D(colorTex, vec2(s,t)).rgb; + float luminance = dot(color, vec3(0.2125, 0.7154, 0.0721)); + if (luminance > 1.0) + { + bloom += color * ((kernelSize+1) - abs(float(x))); + } + } + + gl_FragColor = vec4(bloom * invScale, 1.0); + }
\ No newline at end of file |