Shadows

Everything about development and the OpenMW source code.
User avatar
Ravenwing
Posts: 335
Joined: 02 Jan 2016, 02:51

Re: Shadows

Post by Ravenwing »

Checked out the artifact for these tonight! They're really very good in about 80% of situations once you play around with the settings a bit. Initially I didn't realize this was the problem, but with distant land on I would get a fair amount of peter panning and lots of flickering with jagged edges, but really only at certain angles, some being worse than others. The worst angles were always looking away from the light source. I suspect most of the peter panning is extremely slight, but the aliasing makes it look way worse. Apart from flickering, the aliasing kind of had a temporal moire pattern thing going on where the jaggies would travel along the edges quickly as the shadows moved with the changing daylight.

BUT once I started playing around with view distances, just to kind of optimize my framerate some more, I found almost all the problems gone! The problem started cropping up around 21000 (for 3 cells). With just 2 cells and about 15000, I had probably the smoothest playing experience I can remember on OpenMW, and the shadows looked great at all angles I could see! Still some peter panning going on but very slight and really only visible in certain areas like Balmora staircases, which seemed to be what brought it out the most. The transition between above water shadows and underwater refracted shadows is very jarring if you encounter it, but I think most people won't see it. Definitely also had shadow pop-in, but seemly mostly on rocks and no pattern I could discern.

TL;DR, make sure you've got your view distance set to a lowish value, aka not taking advantage of distant land. It honestly isn't that bad though, because even with 2 cells extra loaded, it gives you a lot more breathing room than vanilla, but still keeps the mysterious feel. Plus you can play with pretty shadows! I have a GTX 970 for reference.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 »

Terrain shadows are pretty thoroughly broken if you've got distant terrain on, so they shouldn't even be attempted. I might fix them before the merge or I might disable them and fix them later in a separate PR.

For 1080p to 1440p, I find 2048 is enough for the shadow map resolution, but more might help. If your view distance is above what can be selected in-game with the slider, you're likely to need to crank up the split point uniform/logarithmic ratio closer to 1. The default settings are really intended for a low-end machine using the default settings for everything else.

I've done no testing with ECLD above the default, because I don't negotiate with terrorists. If it turns out the quality is worse than expected with it on, it's not a priority... especially as there's not much that could be done - I'm already using CSM and LiSPSM, but most games get away with just CSM.

Flickering and Peter Panning have a few causes, one of which I've got a good idea of how to eliminate, another of which is basically a case of parameter tuning until everything looks right, and a third is distant terrain's fault because it's broken.
User avatar
Ravenwing
Posts: 335
Joined: 02 Jan 2016, 02:51

Re: Shadows

Post by Ravenwing »

I definitely need to read up more on the different settings, to see if I can optimize further in any meaningful way. Regardless, great job! Very excited to see what the future brings!

Is it trivial to add some kind of blur to the shadow edges? It’s really cool having the nice crisp edges, but I think it would look better and allow lower map resolution if the edges could be blurred. Might obscure some of the aliasing and such as well.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 »

Blurring everything at the edges is an option, but it's not one I like. Shadow map resolution actually has a very, very small performance impact compared to what you might expect, so turning it up is almost always an option if shadows are too pixelated. Try the shadows on an OGRE build of OpenMW (e.g. 0.36.1) and you'll see how it can look terrible to just blur things at the edges.

Blurring based on distance to the shadow caster is another option, though, and would be a much better approximation of how real shadows look. The obvious technique for that is Percentage-Closer Soft Shadows, which is widely used and relatively simple to implement. The only problem with that is that I have a strong suspicion that it'll be more complicated than I'd like to make it work with our light-space perspective transform, and I can't find much online about people integrating PCSS and LiSPSM (except for the phrase "friends don't let friends use perspective shadow maps", which isn't helpful as while we could achieve the same quality by throwing more CSM splits at the problem, that would have a huge performance impact).
Jerome89
Posts: 8
Joined: 04 Oct 2018, 12:35

Re: Shadows

Post by Jerome89 »

Hi all,
first of all thank you very much AnyOldName3 for the hard work on shadows re-implementation :-)
I'm about to give a try to the 0.45 RC. I thought shadows would be available in the 0.45 release, but I realize they probably won't. Can you tell me if I can easily install the changes you already made about shadows implementation with the 0.45 release, and how to do it ?
As far as i understand, with default settings values, everything seems ok about shadows except for the terrain shadows
Jerome
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 »

If you're on Windows, you can use the AppVeyor artefacts produced during our continuous integration testing. On the page for the shadow PR, at the bottom, you'll see it say that all checks have passed. If you expand that, choose AppVeyor, then one of the jobs, there should be an artefacts tab, and that should have something you can download.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: Shadows

Post by CMAugust »

Can anyone else confirm a severe drop in framerate when looking at the fumes of Dagoth Ur?
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: Shadows

Post by wareya »

I've always, always gotten massive framerate drops when walking through massive particle pumes, including the ones in the propylon chambers. Not even shadows related for me, but now that I think about it, I should try to see if shadows make those things worse for me.
User avatar
Ravenwing
Posts: 335
Joined: 02 Jan 2016, 02:51

Re: Shadows

Post by Ravenwing »

I’ll try and test this out in the next few days. It might be worth mentioning that it’s possibly an antialiasing problem. Don’t recall ever having this problem in OpenMW but I distinctly remember Oblivion basically dying with AA on around the Oblivion gates because it was trying to AA the particles.

Update: I didn't experience any drop in FPS due to particles that I could find. Biggest FPS drop for me is the Bitter Coast region around Hla Oad, probably due to high number of objects at 2 cells. Biggest bottleneck is CPU 1 for me by far, CPU 0, 2-8 are doing very little to nothing. All other system resources remain fairly constant.
i30817
Posts: 58
Joined: 07 Nov 2018, 05:56

Re: Shadows

Post by i30817 »

I've had spikes with 'godrays' (it might be particles) in the beginning of Thelas ancestral tomb.

But that's probably because my computer is crap from 2008 underclocked not to die.

Still if one instance of something like that on a simple staircase scene where you'd expect everything else was culled is enough to spike things like that, maybe its performance should be analyzed.

I recommend if you're using linux to take a plugin like 'radeon dpm control' and set the gpu to 'low performance/battery' to see exactly where performance might tank.
Post Reply