mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 17:15:35 +00:00
Cutoff conditional in light shader
This commit is contained in:
parent
05a5cee132
commit
ec27e60284
2 changed files with 12 additions and 1 deletions
|
@ -448,7 +448,7 @@ lighting method = experimental
|
|||
# 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
|
||||
# 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.
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
#if @ffpLighting
|
||||
|
|
Loading…
Reference in a new issue