This code can be compiled on HW without branches support (given enought instruction slots):
Code:
void main(void)
{
vec4 color;
// This test is there to kill reverse projections from the spotlights:
if (tc_shadow.z > gl_DepthRange.near)
{
// Attenutation:
float a = 1.0 - clamp(length(L)/75.0, 0.0, 1.0);
// Diffuse:
vec4 I = max(dot(normalize(N), normalize(L)), 0.0) * brightness;
// Sample the spotlight "gel" texture and the shadow map:
vec4 gel = texture2DProj(t_gel, tc_shadow);
vec4 s = shadow2DProj(t_shadow, tc_shadow);
// Final shaded color:
color = a * Kd * I * gel * s;
}
else
{
// Fragments behind the projector are black.
color = vec4(0.0, 0.0, 0.0, 1.0);
}
// We write the LDR and HDR portions of the image to separate images.
// LDR is the [0, 1] part:
gl_FragData[0] = min(color, 1.0);
// HDR is everything that's > 1:
gl_FragData[1] = max(color - 1.0, 0.0);
}
Main reason why Tom's demo is not running on ATI cards - is the lack of support of EXT_framebuffer_object extension. But it's rather new and people just have to wait for ATI to release new drivers (not sure maybe Cat 5.6 already supports it?)
Bookmarks