Vignette Effect

Tweet glsl opengl shaders code-archives
(Posted 2 years ago) RonTek

straight-up no frills vignette effect for OpenB3D, great with survival and post-apoc games!

OpenB3D - Vignette Effect GLSL


Local shader:TShader=LoadShader("","../glsl/default.vert.glsl", "../glsl/vignette.frag.glsl")
ShaderTexture(shader,colortex,"texture0",0) ' Our render texture
ShadeEntity(screensprite, shader)


uniform sampler2D texture0;

uniform float Radius;
uniform float Softness;

void main() {   

    vec4 Color = texture2D(texture0, gl_TexCoord[0].xy);        
    vec2 screenpos = gl_TexCoord[0].xy * vec2(1.0, -1.0);
    float dist = length(screenpos - 0.5);    
    float vignette = smoothstep(Radius, Radius - Softness, dist);    
    Color.rgb = mix(Color.rgb, Color.rgb * vignette, 1.0);    
    gl_FragColor = Color;   

(Posted 2 years ago) markcwm commented:

Hi Ron,

it's a nice and simple effect, it does add a bit of nostalgia to the scene. I'm thinking it would also suit an RPG.


(Posted 2 years ago) RonTek commented:

Ah yes of course, RPG games would be nice as well! :D

Reply To Topic (minimum 10 characters)

Please log in to reply