Eroded and Enhanced 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.
User avatar
Freak2121
Posts: 60
Joined: Fri Sep 08, 2017 6:14 am

Re: Eroded and Enhanced Terrain

Post by Freak2121 »

I really don't know what to even look for. Perhaps this section of TerrainComputer.cs is relevant?

Code: Select all

        /// <summary>
        /// Replaces the heightmap buffer in the WoodsFile with a 1000x500 version of the Interesting Terrains heightmap.
        /// </summary>
        public static void InitializeWoodsFileHeightmap()
        {
            var woodsFile = DaggerfallUnity.Instance.ContentReader.WoodsFileReader;
            var original = woodsFile.Buffer;
            originalHeightmapBuffer = new byte[original.Length];
            for (int i = 0; i < original.Length; i++)
            {
                originalHeightmapBuffer[i] = original[i];
            }

            var alteredHeights = new ComputeBuffer(original.Length, sizeof(float));

            var cs = UnityEngine.Object.Instantiate(InterestingTerrains.mainHeightComputer);
            var k = cs.FindKernel("CSMain");

            cs.SetFloat("newHeight", Constants.TERRAIN_HEIGHT);
            cs.SetFloat("maxTerrainHeight", 2308.5f);
            cs.SetFloat("scaledOceanElevation", 27.2f);
            cs.SetFloat("baseHeightScale", 8f);
            cs.SetFloat("noiseMapScale", 4f);
            cs.SetFloat("extraNoiseScale", 10f);
            cs.SetVector("terrainSize", new Vector2(WoodsFile.MapWidth, WoodsFile.MapHeight));
            cs.SetVector("terrainPosition", Vector2.zero);
            cs.SetTexture(k, "BiomeMap", InterestingTerrains.biomeMap);
            cs.SetTexture(k, "DerivMap", InterestingTerrains.derivMap);
            cs.SetBuffer(k, "Result", alteredHeights);
            InterestingTerrains.instance.csParams.ApplyToCS(cs);

            cs.Dispatch(k, WoodsFile.MapWidth / 10, WoodsFile.MapHeight / 5, 1);

            var floatHeights = new float[original.Length];
            alteredHeights.GetData(floatHeights);

            alteredHeightmapBuffer = Utility.ToBytes(floatHeights);
            woodsFile.Buffer = alteredHeightmapBuffer;

            baseHeightmap = new Texture2D(WoodsFile.MapWidth, WoodsFile.MapHeight);
            baseHeightmap.SetPixels32(ToBasemap(alteredHeightmapBuffer));
            baseHeightmap.Apply();

            alteredHeights.Release();
            alteredHeights.Dispose();
        }

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

Re: Eroded and Enhanced Terrain

Post by Interkarma »

Yep! We've got this. :) Comparison below of 0.12 (left) and 0.13 (right) after fixes.

comparison.jpg
comparison.jpg (1.25 MiB) Viewed 1648 times

To fix, I only had to do the following:
  1. In Assets/Maps > untick sRGB and Apply for all textures
  2. In InitializeWoodsFileHeightmap(), change the new Texture2D() line to below. This creates texture as linear.

Code: Select all

baseHeightmap = new Texture2D(WoodsFile.MapWidth, WoodsFile.MapHeight, TextureFormat.ARGB32, false, true);
Then update versions, rebuild, and you have a working mod again.

So happy it was a simple thing! :)

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Eroded and Enhanced Terrain

Post by King of Worms »

Great job guys, Im happy as well :)

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

Re: Eroded and Enhanced Terrain

Post by Freak2121 »

Thank you, Interkarma. I'll be putting out an update very soon. :)

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

Re: Eroded and Enhanced Terrain

Post by Jay_H »

Continuing the conversation from the Distant Terrain thread: this is what's in my player log when I mix Distant Terrain and IET on 0.13.1.

Code: Select all

==> Interesting Terrains: No tileData found for map pixel 381x83 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)

NullReferenceException: Object reference not set to an instance of an object
  at Unity.Collections.NativeArray`1[T]..ctor (System.Byte[] array, Unity.Collections.Allocator allocator) [0x00001] in <e0319199624e47f2b61fa4f72ffdb9ee>:0 
  at Monobelisk.InterestingTerrainTexturer.ScheduleAssignTilesJob (DaggerfallWorkshop.ITerrainSampler terrainSampler, DaggerfallWorkshop.MapPixelData& mapData, Unity.Jobs.JobHandle dependencies, System.Boolean march) [0x0001d] in <ae659302a68f4d1a8b5756d508b5fb1f>:0 
  at DaggerfallWorkshop.DaggerfallTerrain.BeginMapPixelDataUpdate (DaggerfallWorkshop.ITerrainTexturing terrainTexturing) [0x00115] in <137da0d09ba34683a2f7e617c5ec363c>:0 
  at DaggerfallWorkshop.StreamingWorld.UpdateTerrainData (DaggerfallWorkshop.StreamingWorld+TerrainDesc terrainDesc) [0x0004a] in <137da0d09ba34683a2f7e617c5ec363c>:0 
  at DaggerfallWorkshop.StreamingWorld.InitPlayerTerrain () [0x00033] in <137da0d09ba34683a2f7e617c5ec363c>:0 
  at DaggerfallWorkshop.StreamingWorld.Update () [0x00093] in <137da0d09ba34683a2f7e617c5ec363c>:0 
 
(Filename: <e0319199624e47f2b61fa4f72ffdb9ee> Line: 0)

Entering new map pixel X=381, Y=83 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
I get a black screen and no response from the keys, including Escape (I can use the console to kill my character, though).

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

Re: Eroded and Enhanced Terrain

Post by Freak2121 »

Strange, I thought maybe it would be the mod load order, but that wasn't it. Then I thought maybe it's that specific location, but that wasn't it either. Here I am at that exact coordinate:

Image

What other mods do you have? And can you send me your save file?

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

Re: Eroded and Enhanced Terrain

Post by Jay_H »

Sure, this is my mod folder, both enabled:

Image

And here's the save file. Ignore the "enchanted compass" warning, I'm not using the mod and it happens without it.

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

Re: Eroded and Enhanced Terrain

Post by Freak2121 »

Can you try using the mod files compiled for Windows instead of the ones for Linux? I managed to get your issue by using the Linux ones. It should still work despite the mismatch. If it works, I may have to just package only the Windows .dfmod.

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Eroded and Enhanced Terrain

Post by King of Worms »

Distant terrain + Interesting Eroded terrain produce these white lines in a square manner. I dont know which mod is the reason, so I will report it here as well.
DaggerfallUnity_2021-11-06_13-30-50.jpg
DaggerfallUnity_2021-11-06_13-30-50.jpg (557.27 KiB) Viewed 1327 times

User avatar
Seferoth
Posts: 665
Joined: Fri Nov 22, 2019 5:45 pm
Location: Finland

Re: Eroded and Enhanced Terrain

Post by Seferoth »

King of Worms wrote: Mon Nov 15, 2021 12:12 pm Distant terrain + Interesting Eroded terrain produce these white lines in a square manner. I dont know which mod is the reason, so I will report it here as well.

DaggerfallUnity_2021-11-06_13-30-50.jpg
Happens to me with Mountains and Hills + Distant Terrain as well. I am suspecting that Distain Terrain is the culprit here.

Post Reply