Hi Guys,
I am having a problem witha vignette shader in Game Maker: Studio. The shader works perfectly in Codea on the iPad, but I don't get any fall-off in GM:S. All I get is a slightly darker screen.
I made the background whit to ease troubleshooting and the background turns to a perfectly even grey (checked in photoshop). So, I know there is not fall-off. It is like smoothstep() isn't happening on the PC.
I have even added a sepia effect to verify that the shader is actually being applied. So with that addition I get an even sepia screen.
// Fragment shader
//uniform sampler2D u_texture;
varying vec4 v_vColor; //"in" attributes from our vertex shader
varying vec2 v_vTexcoord;
const float RADIUS=0.5;
const float SOFTNESS=0.45;
uniform vec2 resolution;
void main()
{
vec4 texColor = texture2D(gm_BaseTexture,v_vTexcoord);
// *** VIGNETTE ***
vec2 pos = (gl_FragCoord.xy/resolution.xy)-vec2(0.25);
float len = length(pos);
float vignette = smoothstep(RADIUS, RADIUS-SOFTNESS, len);
texColor.rgb = mix(texColor.rgb, texColor.rgb * vignette, 0.5);
// *** SEPIA ***
vec3 lum = vec3(0.299, 0.587, 0.114);
float gray = dot(texColor.xyz, vec3(0.299, 0.587, 0.114));
texColor = vec4(gray, gray, gray, texColor.w);
texColor.rgb *= vec3(1.15,1.1,0.8);
gl_FragColor = texColor * v_vColor;
}
Any help on this would be awesome. I am completely out of ideas.