Page 1 of 1

Light Optimizations

Posted: Thu Dec 17, 2020 7:27 pm
by joshcamas
I've noticed a lot of lights can often end up enabled at once in daggerfall. This is fine for DFU vanilla, but once mods are piled on, this can cause issues.

One neat trick that is extremely optimal is to fade lights once they are a certain distance away! However, I think such an implementation needs to be done carefully - other mods/systems (such as flickering lights) want to affect the intensity of lights. So: how should this be done?

In my own open world project, I implemented such a feature: https://github.com/joshcamas/lightinten ... tensity.cs

This allows other components to register a light intensity, light enabled, or shadow distance function. The light then goes through the registered functions and runs them, passing the modified intensity value through.

Is this something that interests you guys? It would require an update from a few mods (such as interior lights), and we'd want to add a setting to allow tweaking of light distance. But I think it would be great for optimization, since lights can get quite expensive :)

Re: Light Optimizations

Posted: Thu Dec 17, 2020 8:37 pm
by King of Worms
Hi, my low level knowledge about this is that DFU only uses the shadow fading (and this solved the performance issues we had in the past with shadows for lights)

So we have the shadows distance setting for interior and exterior separately.
For the actual light distance, I dont think so. But Im not sure the lights are that taxing in DFU, its the shadows they can cast.
But I can be wrong - and EVERY optimalization is welcomed IMO.

Problematic part I currently see is for example the Privateers Hold part, where there are 7 light sources at one place - all casting real time shadows - and that gets quite intensive on the HW. If this could be somehow optimized, It would be cool.
Well. I hope someone more knowledgeable than me drops by :D

PS: Your game looks absolutely LOVELY!!!!! Found it yesterday on Twitter. I love it. Its the kind of graphics I always wanted to create in a game. But my coding abilities are zero unfortunatelly. Still... I know I can do everything if I focus on it. So maybe one day....
Spoiler!
01.jpg
01.jpg (635.21 KiB) Viewed 1982 times

Re: Light Optimizations

Posted: Thu Dec 17, 2020 11:01 pm
by joshcamas
Ahh good to hear there is already shadow fading. As for that example, that would be solved by just having one light in the center. That's a pretty common trick.

And aw why thank you! :)

Re: Light Optimizations

Posted: Fri Dec 18, 2020 1:08 pm
by pango
joshcamas wrote: Thu Dec 17, 2020 11:01 pm As for that example, that would be solved by just having one light in the center. That's a pretty common trick.
That's what classic usually does with dungeon lights; I suspect it's "de-optimized" by improved interoing lighting mod, that recreates light sources from objects...

Re: Light Optimizations

Posted: Fri Dec 18, 2020 1:33 pm
by Ralzar
pango wrote: Fri Dec 18, 2020 1:08 pm
joshcamas wrote: Thu Dec 17, 2020 11:01 pm As for that example, that would be solved by just having one light in the center. That's a pretty common trick.
That's what classic usually does with dungeon lights; I suspect it's "de-optimized" by improved interoing lighting mod, that recreates light sources from objects...
And possibly Torch Taker. Had to replace the torch lights with identical new lights to get the mod to work.