Shadows

Everything about development and the OpenMW source code.
User avatar
raevol
Posts: 2948
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Shadows

Post by raevol » 02 Feb 2019, 02:47

You guys, nightlies and releases are what testing are for. If it's "too much work" to merge into 0.45, fine. And if code needs to be reviewed before it gets merged, fine. But please, no one is going to test it while it is sitting in an unmerged branch. Let's get this show on the road already.

User avatar
Capostrophic
Posts: 593
Joined: 22 Feb 2016, 20:32

Re: Shadows

Post by Capostrophic » 02 Feb 2019, 13:22

The engine is still suffering from pathfinding PR being merged way too early for no reason, plz no.

CMAugust
Posts: 160
Joined: 10 Jan 2016, 00:13

Re: Shadows

Post by CMAugust » 02 Feb 2019, 14:19

First of all, a big thanks to AnyOldName3 for continuing to knock Shadows into shape. I tested a recent artifact while copying arkortunov's settings. What follows is a list of observations I didn't notice in AnyOldName3's list of issues.

Good news: I've been unable to reproduce the performance drop I had reported in certain bad-weather areas in earlier builds. Areas like Dagoth Ur now appear to run just fine, with no extraordinary framerate dips.

Now onto the rest... (click to view)
Spoiler: Show
That's all I've noted so far; thanks again for carrying on with this.

User avatar
Husaco
Posts: 18
Joined: 07 Aug 2011, 11:54
Location: Australia

Re: Shadows

Post by Husaco » 02 Feb 2019, 16:37

One problem I'm getting testing with the latest build artifact that I haven't seen talked about is some objects getting a light-coloured lip at their bases at night:
shadowglitch.png
shadowglitch.png (450.33 KiB) Viewed 1559 times
Apart from that I'd say they work great 90% of the time, with the other 10% being jags and sawtooth effects to varying degrees of ugliness.
jags.png
jags.png (258.96 KiB) Viewed 1559 times

User avatar
faerietree
Posts: 6
Joined: 14 Aug 2018, 19:33
Contact:

Re: Shadows

Post by faerietree » 02 Feb 2019, 16:59

Nice testing.

Regarding the 10% of zig zag shadows, I don't consider the most recently posted image necessarily ugly. In nature a bark f.e. is rough and shadows also aren't perfect all the times, they are quite blurry. Of course this is only one screeny and the effect may be worse on others.

If performance is better the way it is now or if it is overwhelming, then I'd say 90% perfection is good enough. Let's not overdo it.

User avatar
wareya
Posts: 318
Joined: 09 May 2015, 13:07

Re: Shadows

Post by wareya » 02 Feb 2019, 18:50

Sawtooth artifacts on shadows are just going to happen with this type of shadowcasting method, stop looking at them and look at the other issues IMO. Edge filtering can be added after everything else is known to function properly.
paying attention to #1751 #2473 #3609 #3862/#3929 #3807 #4297 #4623

User avatar
AnyOldName3
Posts: 1390
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 02 Feb 2019, 19:50

Some strange behavior at extreme sunset angles. Note the area roughly where the soldiers are as the camera moves around.
https://streamable.com/fc7dw
That doesn't look like it's supposed to happen. Can I get a save game right there along with your settings (not just shadow settings as stuff like view distance makes a difference, too).
Underwater shadows only appear in the underwater view.
https://streamable.com/jhx9d
Known. Sort of deliberate, too - the refraction camera uses a different view matrix and there'd be work involved with working out how to convert between the two coordinate spaces. It's a good candidate for a follow-up PR.
The shadow itself is unaffected by the water normals, which looks especially strange in choppy conditions.
https://imgur.com/m4Om94K
Normals don't actually affect shadows at all. The thing that would make a difference would be a height map, and we don't have one of those for the water. It's maybe something that could be done in the future, but it might be pretty complex in practice.
It's well known that looking towards or away from the sun decimates the shadow quality. A high view distance + distant terrain makes this even more dramatic.
https://streamable.com/xd64t
And its especially noticeable effect on distant objects, such as the trees behind the fort in this before and after:
https://imgur.com/8WA0BGs
https://imgur.com/Lep52lk
These viewing angles are very common during play, and view distance is certain to be increased by future players, so I expect this to remain a conspicuous issue.
I've been considering alleviating this by adding a setting to control the maximum distance that shadows can be from the camera. This is pretty much how modern games with long view distances manage to do it (although sometimes they have prebaked lighting to fill in the gaps). Nothing else can really help except significantly increasing the shadow map resolution (which, in my testing, hasn't actually had a massive performance hit).
Turning off shadows appears to break the water shader.
https://streamable.com/0s382 (shadows off)
https://streamable.com/l5i4w (shadows on)
That's bad. Can you get me an APITrace of it being broken, please? There should be a thread somewhere explaining how. Maybe testing with an artefact from before normal offset shadows got merged, too, as that's the only thing I've done recently that might have broken it, and I'd have expected someone to have reported this already if it's been broken for a long time.
Regarding that last video, I can't help but comment on the ruinous increase in draw time with shadows enabled. I appreciate that shadows are rather costly, but going from what was an average of 100+ fps in this scene to below 60 seems unusually severe. It also appears to make the fans of my GTX 970 spin up more than Skyrim SE, which is a first for OpenMW in my testing. I hope the subject of performance continues to be examined, as it feels like there's more to be discovered.
Shadows basically require a whole extra rendering pass for each shadow map containing everything that might end up casting a shadow into the map. Even in modern games, that's a lot of extra work, and Morrowind's assets aren't especially amenable to being drawn efficiently when there are more than a few of them at once.
One problem I'm getting testing with the latest build artifact that I haven't seen talked about is some objects getting a light-coloured lip at their bases at night:
Do you know when this started? Has it been an issue for a while?
Zig-zags, pixels and general blockyness
At you end, this can be lessened with a higher shadow map resolution. In other games, there are two main solutions that actually ever get used.

The first is Percentage Closer Filtering. Basically, you do the shadow depth test on lots of nearby texels. GLSL 1.2 (what OpenMW uses) only provides a nice way of doing this for the closest 4 texels, and we already do this. Doing more is possible, but it will also make places where the shadows are already sharp look blurry.

The second is Variance Shadow Maps where as well as having a depth map, you have a depth squared map (both of which can be scaled and filtered like any other texture) and then you can work out the variance of the depth in the shrunken map and therefore estimate what ratio of samples would pass the depth test. Unfortunately, it has some major artefacts which look very bad. I've looked into it a little recently, and am beginning to think that these are more easily surpressed than I initially thought.

Either way, these are both things for a follow-up PR if ever.
AnyOldName3, Master of Shadows

CMAugust
Posts: 160
Joined: 10 Jan 2016, 00:13

Re: Shadows

Post by CMAugust » 03 Feb 2019, 03:01

AnyOldName3 wrote:
02 Feb 2019, 19:50
Some strange behavior at extreme sunset angles. Note the area roughly where the soldiers are as the camera moves around.
https://streamable.com/fc7dw
That doesn't look like it's supposed to happen. Can I get a save game right there along with your settings (not just shadow settings as stuff like view distance makes a difference, too).
Save File
Settings.cfg
I'll add that I could not reproduce this on older build artifacts.
Underwater shadows only appear in the underwater view.
https://streamable.com/jhx9d
Known. Sort of deliberate, too - the refraction camera uses a different view matrix and there'd be work involved with working out how to convert between the two coordinate spaces. It's a good candidate for a follow-up PR.
It might be worth examining bzzt's MR on GitLab, as it appears he's got it working.
I've been considering alleviating this by adding a setting to control the maximum distance that shadows can be from the camera. This is pretty much how modern games with long view distances manage to do it (although sometimes they have prebaked lighting to fill in the gaps). Nothing else can really help except significantly increasing the shadow map resolution (which, in my testing, hasn't actually had a massive performance hit).
I would hate to lose distant shadows. Is that really the only proper solution to alleviate this? Even in games where shadows can be several kilometers away (Star Citizen comes to mind), I can't think of an instance where shadows behave like this. Shouldn't we see at least a hint of this behavior in other games?
Turning off shadows appears to break the water shader.
https://streamable.com/0s382 (shadows off)
https://streamable.com/l5i4w (shadows on)
That's bad. Can you get me an APITrace of it being broken, please? There should be a thread somewhere explaining how. Maybe testing with an artefact from before normal offset shadows got merged, too, as that's the only thing I've done recently that might have broken it, and I'd have expected someone to have reported this already if it's been broken for a long time.
I'll see if I can figure out APITrace. For now I can say it doesn't break like this on my pre-normal offset artifacts.
Shadows basically require a whole extra rendering pass for each shadow map containing everything that might end up casting a shadow into the map. Even in modern games, that's a lot of extra work, and Morrowind's assets aren't especially amenable to being drawn efficiently when there are more than a few of them at once.
As far as assets go, I'm using Morrowind Optimization Patch and Project Atlas to be as draw-efficient as possible, though it's still not enough to maintain 60fps in all areas even at vanilla viewing distance. I'd like to hold out hope the situation can improve in the future, engine-side as well as assets.
One problem I'm getting testing with the latest build artifact that I haven't seen talked about is some objects getting a light-coloured lip at their bases at night:
Do you know when this started? Has it been an issue for a while?
Possibly because the sun is casting shadows through the ground at night. This also did not occur in older artifacts.

User avatar
AnyOldName3
Posts: 1390
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 05 Feb 2019, 22:15

CMAugust wrote:
03 Feb 2019, 03:01
Turning off shadows appears to break the water shader.
https://streamable.com/0s382 (shadows off)
https://streamable.com/l5i4w (shadows on)
That's bad. Can you get me an APITrace of it being broken, please? There should be a thread somewhere explaining how. Maybe testing with an artefact from before normal offset shadows got merged, too, as that's the only thing I've done recently that might have broken it, and I'd have expected someone to have reported this already if it's been broken for a long time.
I'll see if I can figure out APITrace. For now I can say it doesn't break like this on my pre-normal offset artifacts.
Have you made any progress with this?
One problem I'm getting testing with the latest build artifact that I haven't seen talked about is some objects getting a light-coloured lip at their bases at night:
Do you know when this started? Has it been an issue for a while?
Possibly because the sun is casting shadows through the ground at night. This also did not occur in older artifacts.
Are you 100% sure the casting through stuff at night is new? I've been seeing weird nighttime shadows since the very beginning. The only way I can think it might have changed would be if someone else changed the path light zero takes at night so it goes in a loop (as I think it might have been doing something else before) and this change only got into a recent artefact because I merged upstream changes.
AnyOldName3, Master of Shadows

unelsson
Posts: 129
Joined: 17 Mar 2018, 14:57

Re: Shadows

Post by unelsson » 06 Feb 2019, 12:24

I tested Shadows PR with the settings "enable shadows = false" and "enable shadows = true", and neither breaks the water for me. With shadows enabled, I can confirm the light artefacts below or at the base of the object, moving as the sun moves, likely the sun casting shadows through the ground.

edit: Tested right before commit 9b92943 Don't rely exclusively on a shadow map when out of its depth range.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests