... or do they? skip shadows for ball light lol

This commit is contained in:
2026-01-29 20:01:55 +01:00
parent 7bd2a5caa6
commit e9aef6d42f
+8 -1
View File
@@ -55,7 +55,14 @@ void main()
float spec = pow(max(dot(norm, halfwayDir), 0.0), shininess);
vec3 specular = specularStrength * spec * lightColor;
if (length(lightVector) < length(fragToBall) && dot(lightVector, fragToBall) < 0.0)
// the ball's light is put inside it, thus it would cast a shadow all over the scene.
// to counter-act this, we can simply exclude it. i should instead move the light.
// either way, it makes for a cool light (shadow?) show.
bool shadow = false;
if (i != 2) {
shadow = length(lightVector) > length(fragToBall) && dot(lightVector, fragToBall) < 0.0;
}
if (!shadow)
result += attenuation * (diffuse + specular) * objectColor;
}