Hi
Can any shader gurus help resolve the following errors? I’m using TD088 Commercial.
And this is the complete shader code
[code]uniform ivec2 uScaledRes;
out vec4 fragColor;
float map(float value, float inMin, float inMax, float outMin, float outMax) {
return outMin + ((outMax - outMin) * (value - inMin) / (inMax - inMin));
}
void main() {
sampler2D sFullRes = sTD2DInputs[0];
sampler2D sFaceData = sTD2DInputs[1];
sampler2D sFrame = sTD2DInputs[2];
int faceCount = int(texture(sFaceData,vec2(0.0)).r);
vec4 color = texture(sFullRes, vUV.st);
for(int i=0; i < faceCount; ++i)
{
vec4 faceData = texture(sFaceData,vec2(((1.5 + i)/uScaledRes.x), 0.0));
vec2 coord = faceData.rg;
vec2 size = faceData.ba;
coord.y = map(coord.y, 0.0, uScaledRes.y, uScaledRes.y, 0.0);
coord.y -= size.y;
vec4 frame = vec4(0.0);
//lower left
vec2 min = coord / uScaledRes;
//top right
vec2 max = (coord + size)/uScaledRes;
vec2 length = max - min;
// frame
if (vUV.s > min.x && vUV.s < max.x &&
vUV.t > min.y && vUV.t < max.y)
{
vec2 frameCoord = vUV.st - min;
frameCoord /= length;
frame = texture(sFrame, frameCoord);
color = mix(color, frame, frame.a);
}
}
// color = vec4(uvCoord.s * 10);
fragColor = TDOutputSwizzle(color);
}[/code]