Here’s the shader. You’ll notice i’m trying to do a distance check from some threshold and apply the other texture then, but at the end I’m just sampling from the texture to make sure it’s working.
[code]#include “Uniforms.glsl”
#include “Samplers.glsl”
#include “Transform.glsl”
#include “ScreenPos.glsl”
varying vec2 vTexCoord;
uniform vec2 cScreenCenter;
uniform vec2 cThreshold;
void VS()
{
mat4 modelMatrix = iModelMatrix;
vec3 worldPos = GetWorldPos(modelMatrix);
gl_Position = GetClipPos(worldPos);
vTexCoord = GetQuadTexCoord(gl_Position);
}
void PS()
{
vec2 relativeTexcoord = vTexCoord - cScreenCenter;
float sqDist = dot(relativeTexcoord, relativeTexcoord);
vec4 diffuse = texture2D(sDiffMap, vTexCoord);
if (sqDist > cThreshold.x * cThreshold.x)
{
vec4 effect = texture2D(sNormalMap, vTexCoord);
gl_FragColor = mix(diffuse, effect, sqDist);
}
else
{
gl_FragColor = diffuse;
}
gl_FragColor = texture2D(sNormalMap, vTexCoord);
}[/code]
Renderpath is as follows:
<renderpath>
<command type="quad" tag="EyeEffect" vs="PostProcessEyeEffect" ps = "PostProcessEyeEffect" output = "viewport">
<texture unit="diffuse" name="viewport"/>
<texture unit="normal" name="Textures/RedOut.png"/>
<parameter name="Threshold"/>
<parameter name="ScreenCenter"/>
</command>
</renderpath>