Skip to content

Instantly share code, notes, and snippets.

@Themaister
Created August 25, 2011 20:48
Show Gist options
  • Save Themaister/1171876 to your computer and use it in GitHub Desktop.
Save Themaister/1171876 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<shader language="GLSL">
<vertex><![CDATA[
void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
}
]]></vertex>
<fragment><![CDATA[
uniform sampler2D texture;
uniform vec2 rubyTextureSize;
void main()
{
vec4 sum = vec4(0);
vec2 texcoord = vec2(gl_TexCoord[0]);
int j;
int i;
vec2 glaredist = vec2(1.024) / rubyTextureSize;
for(i = -4; i < 4; i++)
{
for (j = -3; j < 3; j++)
{
sum += texture2D(texture, texcoord + vec2(j, i) * glaredist) * 0.25;
}
}
vec4 tex = texture2D(texture, texcoord);
if (tex.r < 0.3)
{
gl_FragColor = sum * sum * 0.012 + tex;
}
else
{
if (tex.r < 0.5)
{
gl_FragColor = sum * sum * 0.009 + tex;
}
else
{
gl_FragColor = sum * sum * 0.0075 + tex;
}
}
}
]]></fragment>
</shader>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment