Dungeons are HW demanding - Dungeon light shadows

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Dungeons are HW demanding - Dungeon light shadows

Post by King of Worms »

Ive noticed this since this option was introduced some year back.

The Dungeon Light Shadows (advanced video options) are super demanding on CPU it seems. I have FX8300 @ 4,1ghz and it can tank to 20 fps on some places (Direnni tower looking from top to bottom, Privateers Hold main room looking up the stairs etc)
Turn Light Shadows off and you have 60fps locked, possibly much more without VSYNC.

What I noticed is, that the shadow resolution settings do NOT impact the performance.. it doesnt matter if you run low or very high, the framerate is still the same at those places.

I think this is caused by the unlimited radius of the displayed shadow sources. OR infinite amount of shadows sources. Limiting the radius, or the max amount of shadows sources could do the trick! Or somehow make the whole effect less demanding. I think as it is now, it calculates all the shadow sources at the direction you are facing. No matter its behind 20 walls on the other side of the dung? Limit it to lets say 30 meter radius, or lets say max 10 shadow sources maybe?

I hope this can get some optimalization in the future. Because its very good effect and I enjoy using it.

I just wanted to make sure its a known issue.

Thank you :)

User avatar
Interkarma
Posts: 7242
Joined: Sun Mar 22, 2015 1:51 am

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Interkarma »

Every dungeon light carries a component called DungeonLightHandler that shuts down light source completely once its a bit beyond 1 RDB block footprint distance from player (about 50 metres). They definitely don't have unlimited range. :) This optimisation actually went in a bit over two years ago, I think around the same time I enabled dungeon shadows.

It's hard to show an example in-game, but here's one from a long hallway in Sentinel castle that I know about. Look at the distant light source at end of hallway. In first screenshot, I'm just outside of range. In second screenshot, I'm just within range for light to turn back on again.

light-out-of-range.jpg
light-out-of-range.jpg (130.7 KiB) Viewed 3057 times
light-just-in-range.jpg
light-just-in-range.jpg (128.87 KiB) Viewed 3057 times

I think optimisation strategies are important, and I definitely don't want to discourage that conversation. But I'll move this one to General as it's more of a discussion item than a bug, and the suggested fix is already in place.

User avatar
Interkarma
Posts: 7242
Joined: Sun Mar 22, 2015 1:51 am

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Interkarma »

BTW, I'm talking standard unmodded DFUnity here. There's a real possibility that modded light sources don't carry the DungeonLightHandler component, in which case this optimisation won't be in place anymore.

I maintain a rock-steady 60fps with vsync on in Direnni with dungeon shadows enabled, and my rig isn't anything special (i7-4400 circa 2013, GTX960, 16GB RAM).

direnni-fps.jpg
direnni-fps.jpg (166.35 KiB) Viewed 3055 times

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Narf the Mouse »

Daggerfall dungeons would greatly benefit from portal occlusion, I think, but since AFAIK that wasn't part of Classic, adding it would probably involve a lot of manual work.

Aside from that, merging meshes would probably help, but you've probably already thought of that. :)
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

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

Re: Dungeons are HW demanding - Dungeon light shadows

Post by King of Worms »

Hmm... than I guess that old Intel is 3x more powerful than FX8300.. that might be the case

I disabled all mods... and made this screen.

You can see I rock a cinematic 24fps :lol:
And the CPU usage is really high.
Its because of the Light Shadows. If I disable them, problem is solved.
I believe there can be some optimalization done. I think each light source is demanding more than it should be.

Just a thing to be aware of, thats all.

Thank you :)

1st screen - Shadows ON
2nd screen - Shadows OFF

Notice the CPU usage drops to cca 1/8 while producing 3x more frames per second if OFF
Spoiler!
AAA.jpg
AAA.jpg (429.18 KiB) Viewed 2963 times
BBB.jpg
BBB.jpg (423.84 KiB) Viewed 2963 times

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Narf the Mouse »

It is possible that your graphics card can't do deferred rendering. So, quick explanation. There's two ways to render lights (vast simplification): Forward rendering, and deferred rendering. Forward rendering is easy. Deferred rendering is fast. What's the difference? Well, let's say that you have 100 objects, and 100 lights:

Forward rendering: Render an object, then render all the lights that affect it. Maximum of 10,000 draw calls. Big O notation: O(o*l).
Deferred rendering: Render all the objects, then render all the lights. Maximum of 200 draw calls. Big O notation: O(o+l).

I'm leaving a bunch of stuff out here, because explaining it would take an essay and also I haven't read the Wikipedia in a while. ;)

Anyway, if your graphics card can't do deferred rendering, Unity Engine will probably (almost certainly) fall back to forward rendering.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

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

Re: Dungeons are HW demanding - Dungeon light shadows

Post by King of Worms »

Thanks for explanation Narf, sorry I did not post my GFX card type before, as I thought this is strictly a CPU issue.

But I have gtx 970... Interkarma has gtx960.. so Im sure this is not the case.

I think his CPU just works better with DFU. But If he measured the CPU usage, he would see insane spike in usage in a places I talk about. Same as me. Difference being, his CPU produces 60fps, so he does not notice it.

I understand this is a optimalization process, which usually takes place further down the road.

I just want to be sure this is considered a issue :) And maybe took care of laters. This clearly is not a good performance, if few light can kill the framerate or make the game almost 10x more demanding in certain situations.

Reminds me of RTX ON/OFF memes :lol:

ifkopifko
Posts: 195
Joined: Thu Apr 02, 2015 9:03 am

Re: Dungeons are HW demanding - Dungeon light shadows

Post by ifkopifko »

I can confirm what KoW says.

- On my setup (Intel i5-3470 + GTX 1060) I do get stable 60fps in the position Interkarma tried, from the bottom of Direnni Tower hall. With shadows ON of course. CPU usage is somewhere above 50%.
- From the top of the hall however, I get cca 53fps, with CPU usage 65-70%, graphics card usage cca 25%.
- If I turn the shadows OFF, CPU usage drops to cca 15%, graphics card usage drops to cca 10%. Framerate 60fps.

User avatar
ByteMixer
Posts: 153
Joined: Sun Mar 25, 2018 4:43 am
Location: Philadelphia, PA, USA
Contact:

Re: Dungeons are HW demanding - Dungeon light shadows

Post by ByteMixer »

I'm having a similar problem, even on my newly built PC (Ryzen 7 1700X, GTX 970, 16GB DDR4 RAM, 256GB SSD)

I'm not sure if it's the same situation, but something I notice, even if I'm just in a corridor in a dungeon, DFU will drop frames like crazy when looking in a certain direction. I think it's when I look the direction of the opposite end of the dungeon.

This is immediately noticeable when I enter Wayrest Castle, as an example. If I go into the dungeons of the castle, things start to smooth the further in I go....e.g. towards the south end of the dungeon, I'll get 70fps or more looking south. But as soon as I turn north, it drops to about 10fps. Looking at the wall entrance of the castle, I get 70fps. I turn around and look at the throne room, and I get 12 fps.

I feel like it's a throwback or something I remember from old games that would try to render the entire worldspace or scene in one pass even if it was behind the walls.

But I have mods running (texture mods, the real grass, realtime reflections post process, distant terrain mods, vivid wind.)

I'll try disabling all mods and see if there's a specific mod that triggers a bottleneck.
"Whatever you do, make good art." - Neil Gaiman

User avatar
ByteMixer
Posts: 153
Joined: Sun Mar 25, 2018 4:43 am
Location: Philadelphia, PA, USA
Contact:

Re: Dungeons are HW demanding - Dungeon light shadows

Post by ByteMixer »

Indeed, all mods off, looking at wayrest castle exit, I get 75 to 77 fps.

I turn around and look at the throne room, and my fps drops about 20fps to about 55 or 56 fps. The mods just make this issue increase by an order of magnitude. Now to turn things on one mod at a time, until something causes a bottleneck.


Update:
Well, I don't know if it's the only cause, but certainly pretty responsible.

I turned on realtime reflections, and only that mod. Looking at exit, no other mods or textures installed, 75fps. Look in the direction of the throne room, and it tanks to 15fps.

Update 2: Indeed, realtime reflections was the primary culprit. I enabled all texture and other mods (post processing, distant terrain, birds, vivid wind, real grass, DREAM, and the hand painted textures/models)

I still had a drop of fps into about 35 to 38 fps looking into the throne room, and 75fps looking at the entrance of Wayrest Castle.

I think there is still a root issue causing frame drops looking towards the far end of any dungeon that is exacerbated by mods that require more processing. I'll check out Direnni Tower next.
Last edited by ByteMixer on Thu Jan 03, 2019 4:39 am, edited 1 time in total.
"Whatever you do, make good art." - Neil Gaiman

Post Reply