[MOD] Distant Terrain
- Nystul
- Posts: 1501
- Joined: Mon Mar 23, 2015 8:31 am
Re: [MOD] Distant Terrain
Interesting, actually I don't understand what could cause post processing mod to have an effect on those bumps. Because I thought pp are only some image effect shaders which could decrease framerate a bit but in a constant way - independent of other stuff. So I would have expected it to lower your overall fps a bit but not increase the bumping.
Distant terrain is definitely causing bumps. That's expected with improved terrain since heights computation in terrainsampler takes some time for every map pixel (several milliseconds). When player moves to a new map pixel a bunch of new terrains needs to be created. This is done over the next couple of second (which causes the bumps)
Another thing that increases the bumps is terrain transition which again touches terrain heights and alters them to match border heights at the transition from near to far terrain.
I want to look into optimizing both issues. It might get a bit better but there will always be a noticeable bump.
I also think that floating origin update takes some time since many objects get their transforms updated.
Distant terrain is definitely causing bumps. That's expected with improved terrain since heights computation in terrainsampler takes some time for every map pixel (several milliseconds). When player moves to a new map pixel a bunch of new terrains needs to be created. This is done over the next couple of second (which causes the bumps)
Another thing that increases the bumps is terrain transition which again touches terrain heights and alters them to match border heights at the transition from near to far terrain.
I want to look into optimizing both issues. It might get a bit better but there will always be a noticeable bump.
I also think that floating origin update takes some time since many objects get their transforms updated.
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: [MOD] Distant Terrain
Are those computations, as I understand, done in a coroutine? Would using some thread so that it could be offloaded to any available CPU smooth the bumps? Difficult part being that Unity API itself is not thread safe...
(found this for example by looking for discussions on the matter)
(found this for example by looking for discussions on the matter)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
- Nystul
- Posts: 1501
- Joined: Mon Mar 23, 2015 8:31 am
Re: [MOD] Distant Terrain
I also planned to do stuff in threads - but the main problem is most things that take time are unity api calls and those are forbidden to be done in separate threads
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: [MOD] Distant Terrain
Exactly what I feared, so sad
It seems only the expensive version of Unity has a workaround for that, from what I understand you can prepare stuff like meshes offscreen then attach them to the main view when they're ready.
Let's hope their work on GPU-optimized terrain generation support will help...
It seems only the expensive version of Unity has a workaround for that, from what I understand you can prepare stuff like meshes offscreen then attach them to the main view when they're ready.
Let's hope their work on GPU-optimized terrain generation support will help...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
-
- Posts: 833
- Joined: Mon Nov 30, 2015 6:32 pm
Re: [MOD] Distant Terrain
As far as mesh creation goes, for multi-threading I create my own mesh class, and convert it to a Unity Engine mesh afterwards for any processing that has to be done Unity-side.
You can create this with just a thin class and List<T>, but I have two context-dependent recommendations:
1) Using a vertex-position-keyed dictionary with the value being the index for that vertex; this will allow automatically trimming out duplicate vertices. For this, I recommend using an "int Index GetOrAdd(Vector3 position)" pattern.
2) Using an adjacency list or dictionary; this will speed up a number of calculations.
You can create this with just a thin class and List<T>, but I have two context-dependent recommendations:
1) Using a vertex-position-keyed dictionary with the value being the index for that vertex; this will allow automatically trimming out duplicate vertices. For this, I recommend using an "int Index GetOrAdd(Vector3 position)" pattern.
2) Using an adjacency list or dictionary; this will speed up a number of calculations.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.
- Nystul
- Posts: 1501
- Joined: Mon Mar 23, 2015 8:31 am
Re: [MOD] Distant Terrain
new version 2.6.0 is available in first post of this thread.
It does not work with current builds because it is using Hazelnut's optimizations for terrain with unity job system.
It works with Hazelnut's branch for UpdateTerrain-onlyJobs and hopefully soon with interkarma's master when the pr is merged
It does not work with current builds because it is using Hazelnut's optimizations for terrain with unity job system.
It works with Hazelnut's branch for UpdateTerrain-onlyJobs and hopefully soon with interkarma's master when the pr is merged
- King of Worms
- Posts: 4753
- Joined: Mon Oct 17, 2016 11:18 pm
- Location: Scourg Barrow (CZ)
- Contact:
Re: [MOD] Distant Terrain
Awesome cooperation guys - the way its ment to be played
DREAM Nexus https://www.nexusmods.com/users/73250038?tab=user+files
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
- pango
- Posts: 3358
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: [MOD] Distant Terrain
I'm seeing a systematic resources unloading when crossing a new map pixel with Distant Terrain mod, that doesn't seem to happen otherwise:
Problem is, this is slow, MarkObjects ~ 120ms is quite standard on my system, no matter how many resources can be collected.
I'm not sure what calls Resources.UnloadUnusedAssets()
Code: Select all
...
Unloading 2434 unused Assets to reduce memory usage. Loaded Objects now: 7958.
Total: 134.304000 ms (FindLiveObjects: 1.049000 ms CreateObjectMapping: 0.404000 ms MarkObjects: 122.909000 ms DeleteObjects: 9.941000 ms)
Entering new map pixel X=413, Y=399
...
I'm not sure what calls Resources.UnloadUnusedAssets()
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
- Midknightprince
- Posts: 1324
- Joined: Fri Aug 11, 2017 6:51 am
- Location: San Antonio TX
- Contact:
- Nystul
- Posts: 1501
- Joined: Mon Mar 23, 2015 8:31 am
Re: [MOD] Distant Terrain
which build do you use?pango wrote: ↑Tue Jan 29, 2019 9:56 pm I'm seeing a systematic resources unloading when crossing a new map pixel with Distant Terrain mod, that doesn't seem to happen otherwise:Problem is, this is slow, MarkObjects ~ 120ms is quite standard on my system, no matter how many resources can be collected.Code: Select all
... Unloading 2434 unused Assets to reduce memory usage. Loaded Objects now: 7958. Total: 134.304000 ms (FindLiveObjects: 1.049000 ms CreateObjectMapping: 0.404000 ms MarkObjects: 122.909000 ms DeleteObjects: 9.941000 ms) Entering new map pixel X=413, Y=399 ...
I'm not sure what calls Resources.UnloadUnusedAssets()
which mod version do you use?