|
@@ -11,7 +11,12 @@ void lightComputeDir(in vec3 worldPos, in float ligthType, in vec4 position, out
|
|
|
vec3 tempVec = position.xyz * sign(posLight - 0.5) - (worldPos * posLight);
|
|
|
lightVec = tempVec;
|
|
|
float dist = length(tempVec);
|
|
|
+#ifdef SRGB
|
|
|
+ lightDir.w = (1.0 - position.w * dist) / (1.0 + position.w * dist * dist);
|
|
|
+ lightDir.w = clamp(lightDir.w, 0.0, 1.0);
|
|
|
+#else
|
|
|
lightDir.w = clamp(1.0 - position.w * dist * posLight, 0.0, 1.0);
|
|
|
+#endif
|
|
|
lightDir.xyz = tempVec / vec3(dist);
|
|
|
}
|
|
|
|