Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/assets/opensb/rendering
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-03-20 01:53:34 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-03-20 01:53:34 +1100
commit6d76a11e256cd96c9cdd7ae5a10c0276e6347277 (patch)
treed52459889408115d1e0eb657a05dc58e098e50eb /assets/opensb/rendering
parent58a346e563df12af9194c198c7ffe974411abb28 (diff)
experiment: unclamped lighting
Diffstat (limited to 'assets/opensb/rendering')
-rw-r--r--assets/opensb/rendering/effects/world.frag8
1 files changed, 7 insertions, 1 deletions
diff --git a/assets/opensb/rendering/effects/world.frag b/assets/opensb/rendering/effects/world.frag
index 10bd1ad..a123096 100644
--- a/assets/opensb/rendering/effects/world.frag
+++ b/assets/opensb/rendering/effects/world.frag
@@ -53,6 +53,12 @@ vec4 bicubicSample(sampler2D texture, vec2 texcoord, vec2 texscale) {
mix(sample1, sample0, sx), sy);
}
+vec3 sampleLight(vec2 coord, vec2 scale) {
+ //soften super bright lights a little
+ vec3 rgb = bicubicSample(lightMap, coord, scale).rgb;
+ return mix(rgb, (rgb / (vec3(1.) + rgb)) * 1.666666, 0.666666);
+}
+
void main() {
vec4 texColor;
if (fragmentTextureIndex > 2.9) {
@@ -72,6 +78,6 @@ void main() {
if (texColor.a == 0.99607843137)
finalColor.a = fragmentColor.a;
else if (lightMapEnabled && finalLightMapMultiplier > 0.0)
- finalColor.rgb *= bicubicSample(lightMap, fragmentLightMapCoordinate, 1.0 / lightMapSize).rgb * finalLightMapMultiplier;
+ finalColor.rgb *= sampleLight(fragmentLightMapCoordinate, 1.0 / lightMapSize) * finalLightMapMultiplier;
gl_FragColor = finalColor;
} \ No newline at end of file