Hi !
I tried different things on Humus' Portal demo to see what i could do with GLSL.
i replaced the fragment shader code by this one :
void main(){
vec4 base = texture2D(Base, texCoord);
float distSqr = dot(lightVec, lightVec);
float atten = clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0);
float diffuse = 0.0;
float specular = 0.0;
if(atten != 0.0){
vec3 bump = texture2D(Bump, texCoord).xyz * 2.0 - 1.0;
bump = normalize(bump);
vec3 lVec = lightVec * inversesqrt(distSqr);
diffuse = clamp(dot(lVec, bump), 0.0, 1.0);
specular = pow(clamp(dot(reflect(normalize(-viewVec), bump), lVec), 0.0, 1.0), 16.0);
}
gl_FragColor = ambient * base + (diffuse * base + 0.6 * specular) * atten;
}
but the frame rate dropped by 10. I though light radius may be large enough to get every fragment lit, thus i added the original shader code the if-statement workload.
So i divided the light radius by 2 (multiplied the invRadius variable by 2) and then it was clear fragment should not be taken care of, but the frame rate stayed at around 90, while it was 105 initialy
thx in advance
wizzo



