Page 56 of 60

Re: [MOD] Distant Terrain

Posted: Sun May 02, 2021 11:44 am
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

Re: [MOD] Distant Terrain

Posted: Sun May 02, 2021 2:55 pm
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.

Re: [MOD] Distant Terrain

Posted: Sun May 02, 2021 7:22 pm
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

Re: [MOD] Distant Terrain

Posted: Mon Oct 18, 2021 3:52 pm
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?

Re: [MOD] Distant Terrain

Posted: Tue Oct 19, 2021 10:40 pm
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. :)

Re: [MOD] Distant Terrain

Posted: Tue Oct 19, 2021 10:42 pm
by Jay_H
Much legend. Great work Freak!

Re: [MOD] Distant Terrain

Posted: Tue Oct 19, 2021 11:10 pm
by Node
I know nothing about programming, coding, or compiling, so I hope we can see this fix happen. Thank you, Freak2121.

Re: [MOD] Distant Terrain

Posted: Tue Oct 19, 2021 11:52 pm
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. :)

Re: [MOD] Distant Terrain

Posted: Wed Oct 20, 2021 12:42 am
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

Re: [MOD] Distant Terrain

Posted: Wed Oct 20, 2021 2:44 am
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. :)