[MOD] Interesting Terrains [WIP]

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

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

Midknightprince wrote: Mon Sep 14, 2020 2:32 pm Any known incompatibility issues before going in ?
Only those listed on the Nexus page :)

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [MOD] Interesting Terrains [WIP]

Post by Hazelnut »

Are you putting the code up anywhere? Need to start thinking about how to make it compatible with roads.

The toggle UI command - IIRC there's already a way to disable the HUD in DFU using shift-F10. I also thought there was a screenshot function as well, but I can't recall what it is so it may be a figment of my mind.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: [MOD] Interesting Terrains [WIP]

Post by Nystul »

hi monobelisk,
once you drop a version for dfunity 0.10.25+ I will take a look why there are compability issues with distant terrain mod (with deactivated terrain sampler of distant terrain mod via settings option)
In principle it should work together then but maybe there is something in distant terrain mod that prevents it ;)

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

Re: [MOD] Interesting Terrains [WIP]

Post by l3lessed »

Thank you so much for this. This game is just getting more impressive all the time with every ones projects.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

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

imsobadatnicknames
Posts: 371
Joined: Sun Jun 02, 2019 4:28 pm
Location: Colombia

Re: [MOD] Interesting Terrains [WIP]

Post by imsobadatnicknames »

Hazelnut wrote: Mon Sep 14, 2020 4:14 pm Are you putting the code up anywhere? Need to start thinking about how to make it compatible with roads.

The toggle UI command - IIRC there's already a way to disable the HUD in DFU using shift-F10. I also thought there was a screenshot function as well, but I can't recall what it is so it may be a figment of my mind.
The screenshot keybind is F8
Released mods: https://www.nexusmods.com/users/5141135 ... files&BH=0
Daggerfall isn't the only ridiculously intrincate fantasy world simulator with the initials DF that I make mods for: http://www.bay12forums.com/smf/index.php?topic=177071.0

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

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

Hazelnut wrote: Mon Sep 14, 2020 4:14 pm Are you putting the code up anywhere? Need to start thinking about how to make it compatible with roads.
My next focus will be cleaning up the code a bit (in terms of clean coding, my delivery can be lacking at times, as I thrive in chaos for some reason) so that I can put it up on GitHub and not feel bad for those who read it :lol:
Hazelnut wrote: Mon Sep 14, 2020 4:14 pm The toggle UI command - IIRC there's already a way to disable the HUD in DFU using shift-F10. I also thought there was a screenshot function as well, but I can't recall what it is so it may be a figment of my mind.
imsobadatnicknames wrote: Mon Sep 14, 2020 11:59 pm The screenshot keybind is F8
Ah, haha - looks like I've re-invented the wheel there! I just saw a post about this feature being planned, but I suppose it must have been quite an old post then.
Nystul wrote: Mon Sep 14, 2020 4:36 pm hi monobelisk,
once you drop a version for dfunity 0.10.25+ I will take a look why there are compability issues with distant terrain mod (with deactivated terrain sampler of distant terrain mod via settings option)
In principle it should work together then but maybe there is something in distant terrain mod that prevents it ;)
All future releases are gonna be for 0.10.25+, regardless of what the stable version is :)

Distant Terrain compatibility would be amazing! Though, I did manage to somehow make it work at one point. There are 2 hurdles to overcome though:

1. If I understand the Distant Terrain code properly, it reads the heights from the woods file heightmap buffer, right? Interesting Terrains also reads from that buffer, then adds new heights on top of that. So modifying the buffer won't be possible, though Interesting Terrains could possibly be modified to expose an alternative buffer that could be used instead.

2. Given the peaky nature of Interesting Terrains, I fear that the distant terrain may not be of a high enough resolution to convincingly render the far away terrain.

Those are the reasons why I'm initially leaning towards attempting a custom solution. But I could of course be wrong (on both counts), and if you think it could work then I'd definitely rather want that to happen!
l3lessed wrote: Mon Sep 14, 2020 6:20 pm Thank you so much for this. This game is just getting more impressive all the time with every ones projects.
Thank you :D

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

Re: [MOD] Interesting Terrains [WIP]

Post by Nystul »

monobelisk wrote: Tue Sep 15, 2020 7:01 am 1. If I understand the Distant Terrain code properly, it reads the heights from the woods file heightmap buffer, right? Interesting Terrains also reads from that buffer, then adds new heights on top of that. So modifying the buffer won't be possible, though Interesting Terrains could possibly be modified to expose an alternative buffer that could be used instead.
yeah - furthermore when distant terrain mod's improved terrain sampler is active it also alters the build-in small heightmap buffer and uses the altered values.
this is how it is done in my mod:

Code: Select all

	int width = WoodsFile.mapWidthValue;
	int height = WoodsFile.mapHeightValue;
	byte[] heightMapBuffer = contentReader.WoodsFileReader.Buffer.Clone() as byte[];
	...
	// here heightmap buffer is changed
	...
	contentReader.WoodsFileReader.Buffer = heightMapBuffer;
I think it should be possible to modify the buffer in your mod and use your modified values in distant terrain mod later - as long as mod order is set correctly and distant terrain mod's terrain sampler is deactivated (I need to test this though, maybe something is not working as intended)
monobelisk wrote: Tue Sep 15, 2020 7:01 am 2. Given the peaky nature of Interesting Terrains, I fear that the distant terrain may not be of a high enough resolution to convincingly render the far away terrain.
definitely a true point but may not be that bad - e.g. if you stand on a hill you should see it
another measure that could be taken from us would be not to just add heights to the base height but let the base height be the average height and let your terrain generation produce positive and negative biases for it (distant terrain's terrain sampler does this) - or maybe it would be enought to shift your heights down on the y-axis by the value of maxHeight/2
monobelisk wrote: Tue Sep 15, 2020 7:01 am Those are the reasons why I'm initially leaning towards attempting a custom solution. But I could of course be wrong (on both counts), and if you think it could work then I'd definitely rather want that to happen!
if a custom solution works better then why not? ;) but lets see if it can be made compatible first ;)

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

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

Nystul wrote: Tue Sep 15, 2020 8:42 am I think it should be possible to modify the buffer in your mod and use your modified values in distant terrain mod later - as long as mod order is set correctly and distant terrain mod's terrain sampler is deactivated (I need to test this though, maybe something is not working as intended)

...

another measure that could be taken from us would be not to just add heights to the base height but let the base height be the average height and let your terrain generation produce positive and negative biases for it (distant terrain's terrain sampler does this) - or maybe it would be enought to shift your heights down on the y-axis by the value of maxHeight/2
Actually, I think in my case it might be better to just store a copy of the original height buffer and use that in my compute shader, but alter the original height buffer so it's accessible by distant terrain. Otherwise I'd find myself in a dilemma, as I'd need an altered height buffer to generate the terrain, but I'd need to generate the terrain to get the altered height buffer to begin with.
Nystul wrote: Tue Sep 15, 2020 8:42 am if a custom solution works better then why not? ;) but lets see if it can be made compatible first ;)
I did have quite an elaborate idea of how I could pull it off without the CPU being involved at all; basically just have a static lo-res plane mesh, then pass the height values generated by the compute shader directly into the mesh material through a render texture and have the mesh material shader do distance based tessellation (that would basically be the LOD system) and then use the generated height values to displace the mesh.

BUT I like the idea of mod features being as modular as possible, so I'll definitely give this a shot first, even if the custom approach would be both a fun and insane experiment :lol:

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

Re: [MOD] Interesting Terrains [WIP]

Post by Nystul »

monobelisk wrote: Tue Sep 15, 2020 3:01 pm Actually, I think in my case it might be better to just store a copy of the original height buffer and use that in my compute shader, but alter the original height buffer so it's accessible by distant terrain. Otherwise I'd find myself in a dilemma, as I'd need an altered height buffer to generate the terrain, but I'd need to generate the terrain to get the altered height buffer to begin with.
you are right ;) whatever works will do the trick
monobelisk wrote: Tue Sep 15, 2020 3:01 pm I did have quite an elaborate idea of how I could pull it off without the CPU being involved at all; basically just have a static lo-res plane mesh, then pass the height values generated by the compute shader directly into the mesh material through a render texture and have the mesh material shader do distance based tessellation (that would basically be the LOD system) and then use the generated height values to displace the mesh.
wow, if you can pull this off, it would be superior to what distant terrain does and much more performant as well.
and if you manage to texture it properly it will also look better than distant terrain mod's ugly shader :)

I really like the terrain generated by your terrain sampler btw ;)

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

Re: [MOD] Interesting Terrains [WIP]

Post by monobelisk »

Nystul wrote: Tue Sep 15, 2020 3:33 pm wow, if you can pull this off, it would be superior to what distant terrain does and much more performant as well.
and if you manage to texture it properly it will also look better than distant terrain mod's ugly shader :)
Well, it would result in even another terrain shader that has to be maintained and kept compatible with other terrain shader mods. And a custom shader would probably be needed for the main terrain as well, in order to ensure a smooth transition. I'll give Distant Terrain a go first, and hope for the best :)
Nystul wrote: Tue Sep 15, 2020 3:33 pm I really like the terrain generated by your terrain sampler btw ;)
Thanks :D
I'm continually amazed by what the fBM algorithms can produce, and how much of a beast the GPU is - at times, it feels like there's no limit to the amount of complex code it can process without leaving a single dent in the FPS. Half of my development time seems to be spent flying through the terrain in high speed just to see what lies next beyond the horizon :lol:

Post Reply