Page 1 of 3

Dungeons are HW demanding - Dungeon light shadows

Posted: Thu Dec 27, 2018 12:29 pm
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 :)

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Fri Dec 28, 2018 9:42 pm
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 3074 times
light-just-in-range.jpg
light-just-in-range.jpg (128.87 KiB) Viewed 3074 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.

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Fri Dec 28, 2018 9:48 pm
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 3072 times

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Sat Dec 29, 2018 8:07 pm
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. :)

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Mon Dec 31, 2018 6:42 pm
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 2980 times
BBB.jpg
BBB.jpg (423.84 KiB) Viewed 2980 times

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Mon Dec 31, 2018 11:17 pm
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.

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Tue Jan 01, 2019 11:12 am
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:

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Tue Jan 01, 2019 11:48 am
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.

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Thu Jan 03, 2019 4:21 am
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.

Re: Dungeons are HW demanding - Dungeon light shadows

Posted: Thu Jan 03, 2019 4:25 am
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.