CPU and Single Core Implications

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: CPU and Single Core Implications

Post by Chris »

AnyOldName3 wrote: 10 Dec 2017, 00:27 The benefits of deferred shading and lighting are that you don't have to do anything with lights at all until you're at a point when you know exactly which lights will affect each pixel and then for each individual light, you can do a single additive pass over the existing framebuffer to add its contribution to each pixel.
Clustered forward rendering works similarly, but avoids the extra additive passes at the cost of slightly more setup. In it, you load all info for the lights affecting the scene into an array stored in GPU memory (an array that can be reused with slight alterations between frames as you move). You divide the viewport into NxMxD sections and build a list of n indices for which lights affect each section (simple bounds testing on basic shapes). Then in the pixel shader, you use the pixel's x/y/z coordinate to calculate which section it's in and get that section's list of lights. After calculating the diffuse color and normal for the pixel, you iterate over the n lights indexed in the list and add their contributions.

This also has the benefit of working with translucent surfaces, since it doesn't depend on a depth buffer to retrieve the pixel location after the diffuse pass (if multiple surfaces can occupy the same pixel, a single depth value isn't sufficient). Similar for the normal buffer, if there's multiple overlapping surfaces a single normal wouldn't be sufficient.
This isn't an issue for most games as per-pixel lighting is more realistic, but when you have the collection of hacks resembling a game engine that Bethesda produced and assets designed with that engine in mind, issues appear.
I don't think per-pixel lighting in Morrowind is that bad. There's a few minor oddities with specific light sources, but nothing particularly garish or game breaking (it's a result of the game expecting per-vertex lighting with relatively large polygons, which was the norm in the late 90s and early 2000s; enabling per-pixel lighting on most games expecting per-vertex lighting would probably expose similar oddities). Mods could even fix those minor issues.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: CPU and Single Core Implications

Post by CMAugust »

Glad to see clustered forward rendering brought up again. Each time it's been suggested in the past there's been no follow-up discussion, which is a shame: not only could it effectively handle Morrowind's considerable number of lights, but it may actually be feasible for every one of them to cast shadows.

It's well worth viewing the 2016 presentation on Clustered Shading from the person who created it https://www.youtube.com/watch?v=uEtI7JRBVXk and his example code is available at http://efficientshading.com/code/ for anyone's perusal, along with numerous articles and papers.
ajira2
Posts: 55
Joined: 30 Oct 2017, 14:27

Re: CPU and Single Core Implications

Post by ajira2 »

Damn it! I just bought fx-9590 :|

It runs at 4.7 Ghz, with turbo 5Ghz

Will OpenMW 0.43 not work faster with it?
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: CPU and Single Core Implications

Post by raevol »

So I'm running an i3-6100 @ 3.70GHz, and I'm getting over 100 fps in outdoor areas, and even 80 fps in the Sadrith Mora slave market, which has been our bottleneck area.

If you have a better CPU than me and you're getting worse performance, you may want to look into other causes...
User avatar
FiftyTifty
Posts: 63
Joined: 15 Oct 2014, 21:02

Re: CPU and Single Core Implications

Post by FiftyTifty »

ajira2 wrote: 15 Dec 2017, 17:25 Damn it! I just bought fx-9590 :|

It runs at 4.7 Ghz, with turbo 5Ghz

Will OpenMW 0.43 not work faster with it?
Are you using an AMD GPU? OpenGL's draw calls are slow as all hell on AMD's driver unfortunately.

If you are using an AMD GPU, give this benchmark a run, to get an idea on how the FX 9590 fares against Intel's architectures: https://forums.anandtech.com/threads/pa ... e.2499609/
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: CPU and Single Core Implications

Post by CMAugust »

Lagahan wrote: 04 Dec 2017, 20:55 Distant terrain is also very new to the OSG renderer and nowhere near optimized so just steer clear of it for now.
My initial query was lost in the broader discussion, but I'd still like to verify if this is correct.
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: CPU and Single Core Implications

Post by lysol »

Guys, I need you to check this mod out: https://www.nexusmods.com/morrowind/mods/45384/

Apparently, one thing it does is replacing alpha blending with alpha testing in the flora, which is one of the things scrawl mentioned might help in this post. So everyone here with bad performance, try this mod out and see if you get better performance. Please report back if you do.
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: CPU and Single Core Implications

Post by CMAugust »

Performance is slightly worse with the performance patch, at least on some cases. Not sure why. Only difference between these two screenshots is toggling the patch on and off in openmw.cfg; you can tell it's active or not by the transparency of the leaves. (viewing distance is set to 666666 in both, cell loading is default)

Patch on
Patch off
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: CPU and Single Core Implications

Post by scrawl »

Turning on alpha testing should allow OpenMW's optimizer to do it's thing that it previously couldn't, so this should improve performance in fact. Maybe the patch is doing something else that's preventing optimizations. Can you click on a tree, type 'showscenegraph' and post the output?
CMAugust
Posts: 285
Joined: 10 Jan 2016, 00:13

Re: CPU and Single Core Implications

Post by CMAugust »

Certainly, here you are. I clicked on the secondmost tree on the right in the image to get this.

https://pastebin.com/aFw0kNvX

And this is with the performance mod disabled:

https://pastebin.com/5GFJd0LY

Looking at the amount of depth sorting that needs to happen in the latter, the results of the profiler make no sense to me.
Post Reply