[MOD] Interesting Terrains [WIP]

Show off your mod creations or just a work in progress.
Post Reply
monobelisk
Posts: 70
Joined: Tue Aug 25, 2020 10:43 am

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

Hazelnut wrote: Mon Nov 02, 2020 8:04 pm What did you do to test it out with roads yourself?
I did the following in BasicRoadsTexturing.ScheduleAssignTilesJob() (get tileData from Interesting Terrains, and comment out GenerateTileDataJob):

Code: Select all

	    // Get tileData from Interesting Terrains
	    byte[] tData = null;
            ModManager.Instance.SendModMessage("Interesting Terrains", "getTileData", new int[] { mapData.mapPixelX, mapData.mapPixelY }, (string message, object data) =>
            {
                if (message == "error")
                {
                    // Should never result in error if used in a TerrainTexturer, and two ints are supplied to the message request
                    Debug.LogError(data as string);
                }
                else
                {
                    tData = data as byte[];
                }
            });
            // Assign byte data directly to native array
            NativeArray<byte> tileData = new NativeArray<byte>(tData, Allocator.TempJob);
            
            // Following block disabled:
	    /*NativeArray<byte> tileData = new NativeArray<byte>(tileDataDim * tileDataDim, Allocator.TempJob);
            GenerateTileDataJob tileDataJob = new GenerateTileDataJob
            {
                heightmapData = mapData.heightmapData,
                tileData = tileData,
                tdDim = tileDataDim,
                hDim = terrainSampler.HeightmapDimension,
                maxTerrainHeight = terrainSampler.MaxTerrainHeight,
                oceanElevation = terrainSampler.OceanElevation,
                beachElevation = terrainSampler.BeachElevation,
                mapPixelX = mapData.mapPixelX,
                mapPixelY = mapData.mapPixelY,
            };
            JobHandle tileDataHandle = tileDataJob.Schedule(tileDataDim * tileDataDim, 64, dependencies);*/
..then further down (assign job with default dependencies, as tileHandleData doesn't exist):

Code: Select all

            NativeArray<byte> lookupData = new NativeArray<byte>(lookupTable, Allocator.TempJob);
            AssignTilesWithRoadsJob assignTilesJob = new AssignTilesWithRoadsJob
            {
                (...)
            };
            // Disabled: JobHandle assignTilesHandle = assignTilesJob.Schedule(assignTilesDim * assignTilesDim, 64, tileDataHandle);
            // Schedule job as normal, but with default dependencies
            JobHandle assignTilesHandle = assignTilesJob.Schedule(assignTilesDim * assignTilesDim, 64, dependencies);
Of course, these changes should only apply if Interesting Terrains is loaded, so it'll have to be handled conditionally.
Hazelnut wrote: Mon Nov 02, 2020 8:04 pm Regarding smoothing, I add a job that just looks for road tiles & water tiles and smooths them. It's quite rudimentary and doesn't use the path data.
I'll need to do additional smoothing at a larger scale to prevent stuff like this from happening:
Image

It definitely would be possible to do it in a post-processing job, using the tilemap as road data, for the heightmap, but the terrain would need to be retextured as well, which also means the roads would need to be repainted. But that should be possible since they already exist in the tilemap. It might be worth a shot, as the tilemap seems like the best source for road data. However, a caveat would be that no trees will be spawned on tiles that were previously steep, such as those in the screenshot.

The objectively better approach would be if it was somehow possible to handle the smoothing during heightmap sampling.


Edit: I've studied the road networks and found out that they're assumedly much simpler than I expected; my assumption is that a map tile's road/path data byte is a set of flags for each corner and edge center of the terrain object, and for each flag that's true a path is drawn at a straight line from its corresponding edge point to the center of the terrain. If my assumption is correct, that's extremely good news! It is fully possible to use that info in the shader to find the nearest road point, AND it minimizes the amount of data that needs to be pre-processed on the CPU before dispatching it to the GPU :D
Last edited by monobelisk on Wed Nov 04, 2020 11:56 am, edited 2 times in total.

haloterm
Posts: 197
Joined: Sat Feb 16, 2019 5:21 am

Re: [MOD] Interesting Terrains [WIP]

Post by haloterm »

monobelisk wrote: Tue Nov 03, 2020 12:59 pm to prevent stuff like this from happening
It would certainly be good if you could do this. But if not, it is maybe still ok. It is like Basic Roads with Distant Terrain ^^

monobelisk
Posts: 70
Joined: Tue Aug 25, 2020 10:43 am

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

Image

So I'm definitely able to use the road data inside the heightmap shader by going with my previously mentioned assumptions. So far, so very good! But I'll have to find a proper smoothing strategy somehow. It's going to be difficult, especially in cases of locations that are close to each other, where one location is at ground level and the other is on the peak of a tall mountain. But I hope for the best!

haloterm
Posts: 197
Joined: Sat Feb 16, 2019 5:21 am

Re: [MOD] Interesting Terrains [WIP]

Post by haloterm »

monobelisk wrote: Thu Nov 05, 2020 3:51 pm Image

So I'm definitely able to use the road data inside the heightmap shader by going with my previously mentioned assumptions. So far, so very good! But I'll have to find a proper smoothing strategy somehow. It's going to be difficult, especially in cases of locations that are close to each other, where one location is at ground level and the other is on the peak of a tall mountain. But I hope for the best!
This screenshots looks already quite plausible to me! Keep it up! :D

monobelisk
Posts: 70
Joined: Tue Aug 25, 2020 10:43 am

Version 0.5.1 released

Post by monobelisk »

New version, 0.5.1, released. It fixes a critical bug, improves a few things and adds initial support for Basic Roads. The latter is not nearly ready, but included as a proof of concept (and because I was already working on it when the critical bug came to my attention). So far, all it does is fade from the normal heightmap to a smoother version of the heightmap when a road tile is close - much like on the screenshot in my previous post.

l3lessed
Posts: 621
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: [MOD] Interesting Terrains [WIP]

Post by l3lessed »

Just want to pop in an say again how dope this mod is, especially now that is is being built with road use too. Thanks for all the work.
My Daggerfall Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
pango
Posts: 2652
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: [MOD] Interesting Terrains [WIP]

Post by pango »

Hi monobelisk,

0.5.1 didn't work so well with BasicRoads 0.9 on my Linux setup:
2020_11_17_12_25_51.jpg
2020_11_17_12_25_51.jpg (156.59 KiB) Viewed 293 times
(Singidge Derry, Dwynnen)

Swapping the load order of Interesting Terrains and BasicRoads didn't help, if that matters.
That was my first test with BasicRoads, so I don't have much experience with it; Distant Terrain + BasicRoads on the same system didn't have that issue though.

P.S. Actually it's Interesting Terrains 0.5.1 that is misbehaving. I've been using 0.4.1 for quite a while and had no issue with it, so it's some kind of regression...
2020_11_17_12_40_56.jpg
2020_11_17_12_40_56.jpg (267.48 KiB) Viewed 292 times
(Whitewold, Dwynnen)
2020_11_17_12_51_59.jpg
2020_11_17_12_51_59.jpg (99.72 KiB) Viewed 288 times
(Scourg Barrow, Dragontail Mountains)
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

monobelisk
Posts: 70
Joined: Tue Aug 25, 2020 10:43 am

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

l3lessed wrote: Mon Nov 16, 2020 5:23 pm Just want to pop in an say again how dope this mod is, especially now that is is being built with road use too. Thanks for all the work.
Thank you :D
pango wrote: Mon Nov 16, 2020 11:35 pm Hi monobelisk,

0.5.1 didn't work so well with BasicRoads 0.9 on my Linux setup:
(Singidge Derry, Dwynnen)

Swapping the load order of Interesting Terrains and BasicRoads didn't help, if that matters.
That was my first test with BasicRoads, so I don't have much experience with it; Distant Terrain + BasicRoads on the same system didn't have that issue though.

P.S. Actually it's Interesting Terrains 0.5.1 that is misbehaving. I've been using 0.4.1 for quite a while and had no issue with it, so it's some kind of regression...
(Whitewold, Dwynnen)
(Scourg Barrow, Dragontail Mountains)
Thanks for the report, and especially for providing screenshots and location names!

I'm unable to recreate the issues on my Windows machine, so it must be Linux specific. But I'm not sure, as I don't currently have a Linux install I can test it on. My best guess is that it's caused by a faulty asset import, for some reason. I've attached an updated version of the mod, in which the problem might be fixed. Could you try it out and let me know if it works? And if not, could you share your logfiles?
Attachments
interesting terrains 0.5.2 linux test.zip
(937.59 KiB) Downloaded 6 times

User avatar
pango
Posts: 2652
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: [MOD] Interesting Terrains [WIP]

Post by pango »

Okay. Just to be sure I made an installation with no other mod, and it's still not working correctly.
Results seem slightly different, but one could say slightly more broken:
2020_11_17_06_27_28.jpg
2020_11_17_06_27_28.jpg (249.7 KiB) Viewed 213 times
2020_11_17_06_28_08.jpg
2020_11_17_06_28_08.jpg (127.87 KiB) Viewed 213 times
It's very trippy though :)
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
pango
Posts: 2652
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: [MOD] Interesting Terrains [WIP]

Post by pango »

Recompiled 0.5.1 from GitHub sources, same thing...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply