Distant Terrain Performance

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Post Reply
CMAugust
Posts: 110
Joined: 10 Jan 2016, 00:13

Distant Terrain Performance

Post by CMAugust » 11 Feb 2018, 14:00

I am unable to eliminate a noticeable pause crossing exterior cell boundaries when distant terrain is set to true, even though the performance impact at other times appears to be minimal. Additionally, in a freshly-loaded exterior (such as travelling from indoors to outdoors or loading a save) one can reliably induce a pronounced stutter simply by turning around on the spot. I would like to know more about how the distant terrain feature works, and what could conceivably be happening in these instances that shouldn't be. As it is, I would be discouraged from using this feature in normal play as I consider a smooth Morrowind experience more important.

User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51
Contact:

Re: Distant Terrain Performance

Post by scrawl » 11 Feb 2018, 16:20

in a freshly-loaded exterior (such as travelling from indoors to outdoors or loading a save) one can reliably induce a pronounced stutter simply by turning around on the spot
Press 'F4' and look at the counter for 'Terrain Composite' or whatever it was called. That's the textures for distant terrain being rendered in the background. If the counter is non-zero, that process is still ongoing, and if you turn around making those regions visible the process will have to complete at once and create that stutter.
Of course, we could make the loading screen block until composite maps are finished. But I would argue that loading faster is more important than avoiding a stutter in rare cases.
If you've already been playing with your character a while, i.e. the save file has grown, I would expect the loading screen should take long enough that the terrain could finish loading before we leave the loading screen. Are you testing with a totally fresh character perhaps?
When moving from interior to exterior, the preloader should have handled everything so there won't be stutters, at least if you've spent enough time in that interior before going out.
If you feel like trying something, the mTimeAvailable in CompositeMapRenderer could need some tweaking, or maybe it should be an option in the settings file. Currently, it's set to 0.5 milliseconds per frame. If you set it higher, the framerate during loading might suffer a little bit, but at least the loading will complete faster then. Alternatively, a smarter scheme that adjusts the available time based on the current framerate could be implemented, much like in osgUtil::IncrementalCompileOperation.
I am unable to eliminate a noticeable pause crossing exterior cell boundaries when distant terrain is set to true
Are you walking at normal speed? What's the F4 overlay say just before that pause, are there unfinished composite maps again?

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

Re: Distant Terrain Performance

Post by CMAugust » 12 Feb 2018, 02:34

Thank you, I've tested further while observing the F4 data. Loading a save outdoors can result in a composite count of well over 100. Even slightly moving the camera around during these times can cause severe choppiness. Even with a high frame rate it can be a lengthy wait (minutes) for this number to reach 0, and each composite seems to take a different length of time to finish. The effect is possibly less on my older large save file than my newer as you suggest, but it's difficult to tell.

Traversing the world only a short distance at normal speed, I've seen the composite increment from 0 to above 50, again leading to visible skipping. It may or may not exactly coincide with the cell border loading as they seem to increment in between too.

Unfortunately I can't presently experiment with mTimeAvailable as I have no experience with a build environment.
Of course, we could make the loading screen block until composite maps are finished. But I would argue that loading faster is more important than avoiding a stutter in rare cases.
I enjoy the near-nonexistent load times of vanilla Morrowind as well so I definitely see where you're coming from, but these cases would need to be truly rare. I encounter them all too often in normal play as it stands.

User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51
Contact:

Re: Distant Terrain Performance

Post by scrawl » 12 Feb 2018, 18:06

Even with a high frame rate it can be a lengthy wait (minutes) for this number to reach 0,
Strange. If I remember right, for me that would complete within a few seconds. What's your video hardware and your FPS like? Can other users confirm this finding?
and each composite seems to take a different length of time to finish.
That's normal. Some are larger than others.

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

Re: Distant Terrain Performance

Post by CMAugust » 12 Feb 2018, 21:48

I have a Core i5 2500k processor and a GTX 970 graphics card. Loading a save looking downward at Tarhiel I was getting an average of 280fps and a composite count of 159, which took 36 seconds to clear standing still. There have been other cases where the wait has been considerably longer but I hadn't measured them more precisely. When walking around Vvardenfell I find force-loading about 10 is fine but anything much higher will produce a skip. And of course using a transportation service means all bets are off.

User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51
Contact:

Re: Distant Terrain Performance

Post by scrawl » 13 Feb 2018, 01:46

Are you maybe using landmass mods like Tamriel Rebuilt? The larger the world, the longer this will take.

Anyway, I've pushed a change that should make things much faster, at least if your framerate is significantly higher than 60. If isn't, you can lower the new 'target framerate' setting to squeeze in some extra preloading cycles. And in any case, the minimum time available is now set to 2.5ms, 5 times the previous value.

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

Re: Distant Terrain Performance

Post by CMAugust » 13 Feb 2018, 01:58

Thanks for looking into this. I'll download the next nightly and post some results. As for Tamriel Rebuit, I haven't tried it in OpenMW yet; this is purely vanilla terrain with maxed view distance. I wonder how much of an impact it makes.

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

Re: Distant Terrain Performance

Post by CMAugust » 14 Feb 2018, 13:42

I've been testing the new feature and the improvement is huge. The test save with 159 composites that loaded in 36 seconds is now doing it in about 8, less if I lower the target framerate. Using a Scroll of Icarian Flight can sometimes look downright smooth. I still feel at least some of the most sizeable load cases (loading outdoor save, travel services, recall spell) could be handled in the loading sequence, but for virtually all other cases of normal play it now works very well.

I do have one concern about this method - if I understand correctly, using vsync or frame limiting of any sort can rule out a potentially huge opportunity for stutter removal. Is the frame-based method a technical necessity?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests