Light Optimizations

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
joshcamas
Posts: 83
Joined: Mon Sep 21, 2020 7:01 am

Light Optimizations

Post 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 :)

User avatar
King of Worms
Posts: 3735
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Light Optimizations

Post 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 383 times

User avatar
joshcamas
Posts: 83
Joined: Mon Sep 21, 2020 7:01 am

Re: Light Optimizations

Post 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! :)

User avatar
pango
Posts: 2762
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Light Optimizations

Post 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...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 1723
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Light Optimizations

Post 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.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

Post Reply