Dungeons are HW demanding - Dungeon light shadows

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Jay_H »

Yeah, Realtime Reflections has been a big resource drain since it was first made :lol: I can't run most of these mods to begin with!

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 »

Update 3:

Direnni tower:

I stand at the pillar in the middle of the room and look straight up: I get about 40 fps. If I go to a corner in the room and look towards the top of the pillar, i get about 34 or 35 fps. However, if I look about half way up the pillar (towards the farthest corner of the room) I get about 25 or 26fps.

So, maybe there is some sort of optimization issue with rendering things behind other objects, even though they're not actually being drawn on screen? I don't think (at least in my case) it has anything to do with the dungeon lighting. It seems more an issue of rendering things in the distance even if they're behind walls and doors.

Again at wayrest castle: Looking at the door entry, I'm seeing about 12% CPU usage. I turn around and look towards the far end of the dungeon, and it's 45% CPU usage. So I'm guessing the game is using CPU to calculate locations of everything in the dungeon? Light sources, objects, room layout, etc. Even if they aren't actually being drawn on screen at the time?

GPU utilzation is about 23% looking at the door. about 30% looking toward the throne room in the castle. So I don't think this is as much a GPU issue as it is a CPU issue.

And I am by no means a guru on this stuff. I don't know anything about the nuts and bolts of how Daggerfall calculates everything within a dungeon space, or if there is a root cause for the increased CPU usage when looking in the direction of the far end of the dungeon. Is this a symptom of the pre-rendered pseudo-procedural dungeons? Or is there something that needs an optimization pass? That's over my head, and way above my pay grade, haha!

I hope my observations help, though!
"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 »

Oh, and just a thought, but FWIW, without mods, I think I'd see near what Interkarma sees in Direnni Tower. Looking at the pillar and toward the ceiling, I'd probably get close to 60fps unmodded. But it's still about 15 or 20fps drop compared to looking toward the closest edge of the dungeon vs. the far end of the dungeon.

If you stand in the exact center of the dungeon, you'd probably have the same fps no matter where you point the "camera"

Outside, in a city or town, or wherever, I get a constant 75 fps, or about 70fps when moving or panning the camera around.
"Whatever you do, make good art." - Neil Gaiman

User avatar
King of Worms
Posts: 4752
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 »

Yes thats how it is, I hope it can get sorted out.
And J, its not realtime reflections we talk about :) More like realtime shadows..

Anyway, its a fact that dungeons are the most hardwared demanding part of DFU, would be nice if it could be considered and optimized in a future.
Last edited by King of Worms on Wed Jan 09, 2019 1:20 pm, edited 1 time in total.

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Jay_H »

King of Worms wrote: Wed Jan 09, 2019 10:23 am And J, its not realtime reflections we talk about :) More like realtime shadows..
Reading! I love it! :D Thanks KOW.

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 »

Interiors are very demanding in general. I get 100% GPU usage in the Mage's Guild in Chesterwark with Realtime Reflections, and ~80% without.
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.

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 »

This is a screenshot taken from the Gothway Garden Mage's Guild in the Unity editor, with no mods (two mods, technically, but both inactive).
Kilotriangles.jpg
Kilotriangles.jpg (590.76 KiB) Viewed 2225 times
The screenshot shows 851 batches, 551 draw calls saved by batching, ~157,900 triangles, and ~464,000 vertices.

Checking the scene, the most complex objects are the stools, at 32 triangles, 68 vertices, and 3 sub-meshes. There are, at most, 200 sub-objects from the Interior root object in the scene (counting and estimating remaining length). If all 200 objects were stools, that would be 6,400 triangles, 13,600 vertices, and 600 sub-meshes.

This isn't due to multiple lights, as the main camera is set to Deferred (I checked). With Deferred rendering, the number of draw calls should equal (or be not much over) the number of meshes + the number of lights.

So, given we have too many draw calls to be explained through rendering, and too many triangles to be explained through models, I would guess we have a bug where something is re-rendering the scene dozens of times.

Unfortunately, I have no way of finding out where that might be, if I've guessed right. :)

Further info to follow.
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
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Interkarma »

That's just how realtime shadows work. If you disable interior shadows from advanced video settings, those numbers will go down a lot. :)

Real-time shadows are just straight-up hardware demanding. Most games use pre-baked shadows to simply this, but that's not a possibility here because the game is 100% dynamically loaded from legacy DOS data. It's not possible to pre-bake lighting into scenes as they don't exist in any form compatible with that.

The simplest answer is if you don't have capable hardware for interior shadows, then it's best just to disable those settings. The exterior uses only a single shadow casting light (the sun) which is relatively lightweight. But even small interiors can have a dozen lights or more, which means rendering the scene several extra times for shadow casters.

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 »

...Well, there it is.

The "I'm wrong" sign. :)
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
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Dungeons are HW demanding - Dungeon light shadows

Post by Interkarma »

During this whole topic, I didn't even think to mention the draw call requirement realtime dynamic shadow at all. Not very helpful of me!

For everyone following along, here's the gist. In order to draw dynamic shadows, every shadow caster in the scene has to render the scene again (sometimes more than once) to work out where shadows are cast. Think of each light within range as another camera looking into the scene. These extra batches create a shadow mask that is overlaid onto the rendered scene. And yes, this is quite a CPU heavy process as well.

Depending on your quality setting, there are some limits to max shadow distance and shadow cascades will create progressively lower resolution shadow maps the farther away shadow casters are. If you're using "Fastest" quality setting then DFU will only render shadows up to 15m away from player camera with no cascades. With "Fantastic" setting it will be 150m and 4 cascades. Daggerfall Unity disables dungeon lights completely after about 50m anyway, so I should consider lowering this to get the benefit of cascades.

There are commercial dynamic shadow solutions that are much faster than what Unity has on offer. But I can't use these in a free MIT-licensed game. If someone is able to find a good, free, open-source shadow system compatible with Unity 2018.x and compatible with MIT license - and doesn't require too many compromises to integrate - then I will consider using this in the game.

For decent dungeon and interior shadows, I recommend a GTX 960 minimum and a newer i5 at least. I should probably consider disabling interior shadows by default as well if too many people are having troubles with it.

Post Reply