Shadow volume?

Feedback on past, current, and future development.
crowbarscientist
Posts: 2
Joined: 10 Jul 2020, 10:08

Shadow volume?

Post by crowbarscientist »

Why is there no shadow volumes in OpenMW like there is in vanilla Morrowind? Would it not look better and perform faster than the shadows used in OpenMW 0.46.0 since the shadows are sharp (and "jaggy") anyways?
User avatar
AnyOldName3
Posts: 2674
Joined: 26 Nov 2015, 03:25

Re: Shadow volume?

Post by AnyOldName3 »

Shadow volumes are an evolutionary dead end and have no place in software created after 2010. That's why basically no software created after 2010 uses them, and the most famous game for having them came out in 2005. Their performance scales really badly as geometrical complexity increases, so they're not appropriate for full-quality modded meshes or full-scene shadows. They also can't do things like have a prenumbra, which is something you can clearly see in the real world (this isn't really something OpenMW does yet except in an abandoned branch, but there's nothing stopping it being added in the future). Finally, it's a nightmare to make them block light rather than just darken things uniformly.

I think most people are happier having shadows that are affected by more than just six objects, actually reflect what those objects look like, and generally behave more realistically than they would be with unrealistically sharp edges, ugly artefacts when things overlap, shadows jumping around when things move etc.
crowbarscientist
Posts: 2
Joined: 10 Jul 2020, 10:08

Re: Shadow volume?

Post by crowbarscientist »

A few game susing this technique has low poly models for the shadows. Grand Theft Auto: San Andreas uses the collision mesh for the shadows and Star Wars Battlefront 1/2 uses the LOD. So i don't think polycount would be a problem
User avatar
AnyOldName3
Posts: 2674
Joined: 26 Nov 2015, 03:25

Re: Shadow volume?

Post by AnyOldName3 »

Morrowind does that, too. It looks awful, though. The whole point of OpenMW is to not be awful.
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Re: Shadow volume?

Post by akortunov »

crowbarscientist wrote: 10 Jul 2020, 15:40 Grand Theft Auto: San Andreas uses the collision mesh for the shadows
Not an option for OpenMW since most of Morrowind's meshes have a very rough collisions.
User avatar
AnyOldName3
Posts: 2674
Joined: 26 Nov 2015, 03:25

Re: Shadow volume?

Post by AnyOldName3 »

Actors have silhouette meshes, though.
Sagacity
Posts: 31
Joined: 05 Mar 2019, 12:58

Re: Shadow volume?

Post by Sagacity »

There's also not a ton to suggest it'd actually perform much faster given that draw calls are our biggest issue. And we know OpenMW's current implementation can, does, and will look better.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Shadow volume?

Post by Chris »

Personally, I do think there is room to improve upon shadow volumes, although it's not likely to happen. The only reason shadow mapping has developed smoother edges and more realistic penumbras and other such things is because people put the work in to improve shadow mapping techniques, as opposed to shadow volume techniques (it's not as if shadow mapping has realistically smooth edges by default either; so whether it's the sharp edges of shadow volumes or the fuzzy blocky edges of shadow mapping, they need to be cleaned up). And that is largely because of 3DLabs/Creative Labs sniping a software patent on the z-fail shadow volume technique after John Carmack got some help from them when implementing it for Doom3, so nobody wanted to work with a patent-encumbered shadowing technique when a patent-free one was also available. The patents are now expired, so one could theoretically do it, but the damage has been done and there's not much to gain at this point, especially as ray-tracing becomes more common.

Practically speaking, shadow volumes are a dead-end for real-time graphics. I toyed around with improving them to moderate success, and can see further ways to improve them (particularly with adapting certain shadow mapping techniques to smooth out edges), but that's extra work and challenges that you otherwise don't need to do since shadow mapping already has it worked out for the most part. And in the end, it probably won't look terribly different. Might still be something fun to do and see just how far it can be taken, but I wouldn't expect much work to be done in that area at a professional level.
User avatar
AnyOldName3
Posts: 2674
Joined: 26 Nov 2015, 03:25

Re: Shadow volume?

Post by AnyOldName3 »

The big drawback of shadow volumes is that they scale much less well with triangle count than shadow maps. With or without the patent issue, they were on their way out, and aren't appropriate for a modern renderer dealing with a modern-ish scene. In fact, the patent may not have been valid due to evidence of prior art https://techreport.com/news/7113/creati ... s-reverse/ so if a company had a strong preference and didn't want to pay Creative for a licence (which might actually have been cheaper) they could likely have litigated and had the patent overturned.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Shadow volume?

Post by Chris »

AnyOldName3 wrote: 03 Feb 2022, 22:46 The big drawback of shadow volumes is that they scale much less well with triangle count than shadow maps. With or without the patent issue, they were on their way out, and aren't appropriate for a modern renderer dealing with a modern-ish scene.
They weren't on their way out back then. It wouldn't have made sense for id Software to work on improving them and make it the backbone of their new uniform lighting and shadowing solution to push real-time computer graphics forward, nor would it have made sense for Creative to patent it in the hopes of getting anything out of it, if they were already at the end of their life. As I understand it, shadow volumes were actually of limited use in games up to that point because the usual z-pass technique had severe limitations with camera and light placement. The z-fail technique was poised to give them life, because it elegantly fixed those limitations and made them viable as a general solution, not be their last hurrah. And as I mentioned, there was still room for further improvements.

The way I see it, the main issue with triangle count and shadow volumes was the need for degenerate triangles in the models, so the back caps could be extruded out to infinity and still connect with the front caps with proper volume edges. However, I don't think this is actually as big of a problem as it may seem, since as triangle count increases with more granular detail, you don't actually need the degenerates; you can simply extrude the appropriate vertices out to infinity while letting them connect to their neighbors nearer the light. The volume's edges will be close enough since the vertices were spatially close to start with. In fact, that was one of the things I did when playing around with them. Just take the model as-is, extrude the appropriate vertices to infinity while letting them connect to their neighbors nearer the light, not bothering with the extra degenerates to create the volume edges, and the casted shadows still looked accurate. I wasn't testing this with a particularly high-poly model either (it was a model from a late era GameCube game). If a model is low-poly enough that this wouldn't work, adding the degenerate triangles for those cases would likely be insignificant. And if that still isn't good enough, I wager geometry shaders could help out with generating the volume edges with less overhead (something that wasn't available back then).

In contrast, shadow mapping does still have its issues with modern-ish scenes, particularly as it relates to point lights and lights with wide FOVs (which are the majority of light sources), since rendering is designed for a limited view frustum, and continually hits fill-rate limits. They get around this by prioritizing spot lights over point lights, utilizing pre-rendered shadow maps, heavily limiting the number of lights that can cast shadows (shadow pop-in is still a thing that happens, as well as obvious missing shadows from light sources), targeting 30fps instead of 60+, and brute forcing it the rest of the way.
AnyOldName3 wrote: 03 Feb 2022, 22:46 In fact, the patent may not have been valid due to evidence of prior art https://techreport.com/news/7113/creati ... s-reverse/ so if a company had a strong preference and didn't want to pay Creative for a licence (which might actually have been cheaper) they could likely have litigated and had the patent overturned.
I wouldn't doubt it was invalid (as most if not all software patents likely are). But most companies aren't in the business of altruism, they won't spend the time and money to fight and invalidate bogus patents in court, and potentially lose (since courts have a history, still today, of not understanding computer science), if they can just avoid the patent to begin with. If anything, they'd just pay the extortion license fee, which would be cheaper, quicker, and less of a hassle than going to court. id Software kept with it was because they were already committed, and since they were offered a license for free, with the only consideration being they had to have an option to use EAX to help sell Creative's audio cards, it was the obvious business decision. But most other developers didn't have such a heavy focus on high-quality dynamic lighting like that, so they could just avoid the patent altogether and stick with lower quality shadow mapping as they found ways to slowly improve them over the years (and hardware power increased to help hide its inefficiencies).
Post Reply