[MOD] Distant Terrain

A curated forum for compatible and maintained mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
Post Reply
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: [MOD] Distant Terrain

Post by Nystul »

Daniel87 wrote: Sat May 01, 2021 11:24 am Wouldn't it be possible to increase the UV coordinates of the texture used for the distant terrain by a factor of 10 or 20 to create the same look despite having fewer vertices?
I tried this of course but it just results in extreme texture flimmering since to aliasing issues and floating point precision issues

thx Jarlyjarljarl for summarizing pretty well how DT works in principle, only thing to add is that DT barely increases standard terrain distance for near terrain (DFU's terrain) - it just uses 1 extra terrain distance unit in case terrain transition is active to blend between near and far terrain

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: [MOD] Distant Terrain

Post by Daniel87 »

Nystul wrote: Sun May 02, 2021 11:44 am
Daniel87 wrote: Sat May 01, 2021 11:24 am Wouldn't it be possible to increase the UV coordinates of the texture used for the distant terrain by a factor of 10 or 20 to create the same look despite having fewer vertices?
I tried this of course but it just results in extreme texture flimmering since to aliasing issues and floating point precision issues

thx Jarlyjarljarl for summarizing pretty well how DT works in principle, only thing to add is that DT barely increases standard terrain distance for near terrain (DFU's terrain) - it just uses 1 extra terrain distance unit in case terrain transition is active to blend between near and far terrain
Did you try something along the lines of using plain colors instead of textures for the distant terrain? I wonder how that would look, when adding a slight flog bluring it a bit.
In Julianos we Trust.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: [MOD] Distant Terrain

Post by Nystul »

in the very beginning - but it looked boring

but feel free to experiment with it - distant terrain code is on github here: https://github.com/Nystul-the-Magician/ ... antTerrain

Node
Posts: 5
Joined: Mon Oct 18, 2021 3:41 pm

Re: [MOD] Distant Terrain

Post by Node »

I'm new to Daggerfall Unity, and I have a question about this mod. I'm not sure if it is working correctly. This is what I see when I look north from Privateer's Hold:

Image

It looks like the terrain in the distance drops into the water, but if I walk forward, more terrain is drawn.

Shouldn't I be seeing more terrain? Or am I confused?

User avatar
Freak2121
Posts: 60
Joined: Fri Sep 08, 2017 6:14 am

Re: [MOD] Distant Terrain

Post by Freak2121 »

I looked into the code for the mod and there were two problems.

Firstly, it had a bunch of dependencies on the old postprocessing, which just isn't there anymore. This kept the mod from functioning at all.
Commenting the lines in question out seemed to get it working. These are the changes I made in DistantTerrain.cs:

Code: Select all

Line 9: using UnityEngine.PostProcessing;
Line 83: private PostProcessingBehaviour postProcessingBehaviour;
Line 253: PostProcessingBehaviour stackedCameraPostProcessingBehaviour = null; 
Line 355: postProcessingBehaviour = Camera.main.GetComponent<PostProcessingBehaviour>();
Line 713 : if (postProcessingBehaviour != null) 
Line 714: {
Line 715: stackedCameraPostProcessingBehaviour = goStackedCamera.AddComponent<PostProcessingBehaviour>();
Line 716: stackedCameraPostProcessingBehaviour.profile = postProcessingBehaviour.profile;
Line 717: }
to

Code: Select all

Line 9: using UnityEngine.Rendering.PostProcessing;
Line 83: //private PostProcessingBehaviour postProcessingBehaviour;
Line 253: //PostProcessingBehaviour stackedCameraPostProcessingBehaviour = null;
Line 355: //postProcessingBehaviour = Camera.main.GetComponent<PostProcessingBehaviour>();
Line 713 : //if (postProcessingBehaviour != null)
Line 714: //{
Line 715: //stackedCameraPostProcessingBehaviour = goStackedCamera.AddComponent<PostProcessingBehaviour>();
Line 716: //stackedCameraPostProcessingBehaviour.profile = postProcessingBehaviour.profile;
Line 717: //}

Unfortunately there was one very apparent issue:

Image

The textures of the distant terrain are all black!

That got me thinking it's related to the change from gamma to linear colourspace, which was messing with the Interesting Terrains mod. So I looked at Interkarma's solution to that problem, and changed the following line from:

Code: Select all

Line 555: textureTerrainInfoTileMap = new Texture2D(terrainInfoTileMapDim, terrainInfoTileMapDim, TextureFormat.RGBA32, false);
to

Code: Select all

Line 555: textureTerrainInfoTileMap = new Texture2D(terrainInfoTileMapDim, terrainInfoTileMapDim, TextureFormat.ARGB32, false, true);
and now it works!

Image

If Nystul is okay with it, I can compile and release it as an update. If not, you can do the changes and compile it yourself. :)
Last edited by Freak2121 on Tue Oct 19, 2021 10:43 pm, edited 1 time in total.

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: [MOD] Distant Terrain

Post by Jay_H »

Much legend. Great work Freak!

Node
Posts: 5
Joined: Mon Oct 18, 2021 3:41 pm

Re: [MOD] Distant Terrain

Post by Node »

I know nothing about programming, coding, or compiling, so I hope we can see this fix happen. Thank you, Freak2121.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: [MOD] Distant Terrain

Post by Interkarma »

Thanks so much Freak! I was planning to loop back and take another look at Distant Terrain, and you've already solved it. Cheers for the help. :)

User avatar
Freak2121
Posts: 60
Joined: Fri Sep 08, 2017 6:14 am

Re: [MOD] Distant Terrain

Post by Freak2121 »

No problem, my terrain mod really isn't much without being combined with this one. I don't think it is a complete fix, but it does seem to be working. :)

One thing I've noticed, which I can't seem to figure out, is that the transition ring between the real terrain and the distant terrain is always water now:

Image

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: [MOD] Distant Terrain

Post by Interkarma »

Now that I think about it, core DFU didn't need to update its tilemap texture creation to be linear. These textures continued to work with internal tilemap shaders as-is. There must be some difference in how mod's transition ring shaders processes terrain tilemap textures.

I also noted classic sky colours are wrong (inverted?) with distant camera stack and postprocessing disabled. Will need to be more tweaks there to support PPv2 changes and not break classic sky.

Still a few things to chase down it seems. I'll help where I can, but I am running out of time. I need to get back to working on 0.13 very soon as it's behind my (self-imposed) schedule now. :)

Post Reply