Created
August 22, 2015 03:09
-
-
Save rasteron/5a2b94874b23faa18ea1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Uniforms.glsl" | |
#include "Samplers.glsl" | |
#include "Transform.glsl" | |
#include "ScreenPos.glsl" | |
varying vec2 vScreenPos; | |
#ifdef COMPILEPS | |
const float cRadius = 0.75; | |
const float cSoftness = 0.45; | |
#endif | |
void VS() | |
{ | |
mat4 modelMatrix = iModelMatrix; | |
vec3 worldPos = GetWorldPos(modelMatrix); | |
gl_Position = GetClipPos(worldPos); | |
vScreenPos = GetScreenPosPreDiv(gl_Position); | |
} | |
void PS() { | |
vec4 Color = texture2D(sDiffMap, vScreenPos.xy); | |
float dist = distance(vScreenPos.xy, vec2(0.5,0.5)); | |
float vignette = smoothstep(cRadius, cRadius-cSoftness, dist); | |
//vignette opacity (50%) | |
Color.rgb = mix(Color.rgb, Color.rgb * vignette, 0.5); | |
gl_FragColor = Color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment