mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-09 21:44:54 +00:00
Cutoff conditional in light shader
This commit is contained in:
parent
05a5cee132
commit
ec27e60284
@ -448,7 +448,7 @@ lighting method = experimental
|
|||||||
# Sets the bounding sphere multiplier of light sources, which are used to determine if an object should
|
# Sets the bounding sphere multiplier of light sources, which are used to determine if an object should
|
||||||
# receive lighting. Higher values will allow for smoother transitions of light sources, but may have a performance cost and
|
# receive lighting. Higher values will allow for smoother transitions of light sources, but may have a performance cost and
|
||||||
# requires a higher number of 'max lights' set. It is recommended to keep this at 1.0 with 'legacy' lighting enabled.
|
# requires a higher number of 'max lights' set. It is recommended to keep this at 1.0 with 'legacy' lighting enabled.
|
||||||
light bounds multiplier = 2.0
|
light bounds multiplier = 1.0
|
||||||
|
|
||||||
# The distance from the camera at which lights fade away completely. Set to 0 to disable fading.
|
# The distance from the camera at which lights fade away completely. Set to 0 to disable fading.
|
||||||
maximum light distance = 8192
|
maximum light distance = 8192
|
||||||
|
@ -101,6 +101,17 @@ void perLightPoint(out vec3 ambientOut, out vec3 diffuseOut, int lightIndex, vec
|
|||||||
vec3 lightDir = getLight[lightIndex].position.xyz - viewPos;
|
vec3 lightDir = getLight[lightIndex].position.xyz - viewPos;
|
||||||
|
|
||||||
float lightDistance = length(lightDir);
|
float lightDistance = length(lightDir);
|
||||||
|
|
||||||
|
#if !@ffpLighting
|
||||||
|
// This has a *considerable* performance uplift where GPU is a bottleneck
|
||||||
|
if (lightDistance > getLight[lightIndex].attenuation.w * 2.0)
|
||||||
|
{
|
||||||
|
ambientOut = vec3(0.0);
|
||||||
|
diffuseOut = vec3(0.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
lightDir = normalize(lightDir);
|
lightDir = normalize(lightDir);
|
||||||
|
|
||||||
#if @ffpLighting
|
#if @ffpLighting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user