Unlimited Light Sources with Clustered Forward Shading

Feedback on past, current, and future development.
User avatar
AnyOldName3
Posts: 1478
Joined: 26 Nov 2015, 03:25

Re: Unlimited Light Sources with Clustered Forward Shading

Post by AnyOldName3 » 05 Mar 2019, 15:08

Also, draw calls really aren't an issue in any of the games OpenMW targets.
Draw calls are definitely one of the biggest bottlenecks in OpenMW's rendering right now. Morrowind is full of tiny meshes and has lots of them as it's from an era when draw calls were never as much of a bottleneck as drawing more polygons, so splitting them up into small groups to be able to cull as many as possible was a good idea. The linked DOOM 2016 frame analysis says it's doing about a fifteenth as many draw calls per frame as we are, and that's definitely for a much more complicated scene.

We're hoping to implement some kind of batching system to combine multiple meshes into one draw call, and that should put a big dent in the number of draw calls.
AnyOldName3, Master of Shadows

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

Re: Unlimited Light Sources with Clustered Forward Shading

Post by wareya » 05 Mar 2019, 17:02

I agree with the above post.
paying attention to #1751 #2473 #3609 #3862/#3929 #3807 #4297 #4623

Chris
Posts: 1558
Joined: 04 Sep 2011, 08:33

Re: Unlimited Light Sources with Clustered Forward Shading

Post by Chris » 05 Mar 2019, 22:37

Concurred. Draw calls are the bane of rendering performance because it requires a thorough state validation every time. Even if you the programmer know the render state is valid (not necessarily correct, but something that makes sense to the rendering pipeline), the driver/hardware is required to check it before starting the render. AZDO techniques (GL4, Vulkan, etc) aim to alleviate the cost by allowing you to store command buffers on the hardware with its render state pre-validated, then you can "indirectly" invoke the renders. Of course, that only helps when you can reuse the same pre-validated command buffers, otherwise when you set up new ones or change their state, they still need validation before they can be executed again.

User avatar
Mistahtokyo
Posts: 118
Joined: 07 Sep 2013, 18:31

Re: Unlimited Light Sources with Clustered Forward Shading

Post by Mistahtokyo » 06 Mar 2019, 18:58

Ignorant user here. How much of these draw call performance issues could be fixed by changing the assets themselves? As in merging smaller meshes into single, larger ones (one house model or fewer, larger sections, etc) vs having the current various smaller meshes?

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

Re: Unlimited Light Sources with Clustered Forward Shading

Post by AnyOldName3 » 06 Mar 2019, 19:08

That actually can help a lot. If you overdo it, though, you end up with issues where things that would have had different light sources are forced to share. That would be eliminated with some of the things discussed here, though.
AnyOldName3, Master of Shadows

User avatar
Mistahtokyo
Posts: 118
Joined: 07 Sep 2013, 18:31

Re: Unlimited Light Sources with Clustered Forward Shading

Post by Mistahtokyo » 06 Mar 2019, 19:12

Hmm it would be doable, but would likely have to be entirely manual as far as placement goes since I don't think one could automate guessing where multiple blended meshes would end up to align as a new one, no?

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

Re: Unlimited Light Sources with Clustered Forward Shading

Post by CMAugust » 07 Mar 2019, 14:46

Automatic batching is the plan, but I think it's still being deliberated how to do it effectively in OpenMW.
AnyOldName3 wrote:
06 Mar 2019, 19:08
That actually can help a lot. If you overdo it, though, you end up with issues where things that would have had different light sources are forced to share. That would be eliminated with some of the things discussed here, though.
I recall the Great Chapel of Talos in Beyond Skyrim: Bruma had to be sliced and diced more than the Oblivion original, as Skyrim's light limit for objects was apparently more conservative than Oblivion's. It was only discovered when the model was in-game and receiving its lighting pass. The modeler had to spend a bunch more time chopping it up. He wasn't very pleased :)
On the other hand, I've viewed several Skyblivion landscaping streams that involved removing large numbers of individual rock objects and replacing them with a single object consisting of a dozen rocks. The result was more interesting and detailed scenery at a fraction of the performance; one of the benefits of Skyrim's more optimal world design.

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

Re: Unlimited Light Sources with Clustered Forward Shading

Post by AnyOldName3 » 08 Mar 2019, 00:18

After reading More Efficient Virtual Shadow Maps for Many Lights, I think there's a lot of stuff that would need to change about OpenMW (and OSG, too) before we could even begin to think about implementing a lot of what it does. It more or less describes DOOM 2016's approach to things (with the differences that DOOM uses Mega Textures to implement virtual texturing, doesn't shadow that many lights and doesn't require CUDA, probably using a compute shader instead).

If someone had an Ola-Olsson-sized bag and access to the Chalmers University of Technology in Gothenburg, Sweden, I'm sure there are some amazing things that could be done with the engine because of it, but the system in that paper is mad-complicated, seems to require a deferred renderer, and definitely requires insanely more batching than it looks like is possible with Morrowind's assets.
AnyOldName3, Master of Shadows

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

Re: Unlimited Light Sources with Clustered Forward Shading

Post by CMAugust » 08 Mar 2019, 01:22

Assuming his LinkedIn is up to date, Ola Olsson is literally half an hour's drive from me. I think there's a decent sized bag lying around here somewhere :)

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

Re: Unlimited Light Sources with Clustered Forward Shading

Post by AnyOldName3 » 08 Mar 2019, 01:56

Get him! Hopefully, your enthusiasm is contagious and you won't need the bag.
AnyOldName3, Master of Shadows

Post Reply