Splat Terrain Texturing

Show off your mod creations or just a work in progress.
Post Reply
User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: High Resolution Terrain Textures

Post by TheLacus »

Hi, thank you for your answer!

I'm using an edited version of standard terrain shader, which combines layers using a splatmap. Specifically, i changed the blending step to perform heightmapping and made some other modifications, mostly to the water layer. Each layer uses two textures, albedo+heightmap (on alpha channel) and normal map, for a total of 6 layers per terrain.

Due to performance concerns i haven't used additional metallicgloss maps. As an alternative, i re-use the heightmap as a sort of roughnessmap to simulate wet terrain. However, the easiest way to retrieve water position is to use the channel reserved to water in the splatmap. It's how smoothness and metallic parameters are assigned in shader (water is red channel here, mixedDiffuse.a is inverse heightmaps combined and scaled for current weather):

Code: Select all

o.Smoothness = max(splat_control.r, mixedDiffuse.a);
o.Metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
I tested it with a reflection probe that refreshes cubemap from player position every frame as well as with screen space reflections. In both cases it works just by setting metallic and smoothness parameters.

If it's not too complex to make it work with your approach, it would be the the best option for quality. I'll send you the source code and a test build within the next few days. :)

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

Re: High Resolution Terrain Textures

Post by Nystul »

thanks for explaining!
TheLacus wrote: Tue Aug 25, 2020 7:07 pm I'll send you the source code and a test build within the next few days. :)
looking forward to try it out

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

Re: High Resolution Terrain Textures

Post by Hazelnut »

Hi TheLacus, this looks great and after suggestion from MasonFace I took a look at the code and saw it's post processing the shader tilemap before using a new shader so i figured it would be compatible with the road painting into tilemap I'm using.. and it is. Roads look fantastic, but unfortunately as you can see in the screen below, dirt tracks look really derpy!
dirt.JPG
dirt.JPG (141.2 KiB) Viewed 6760 times
This is kinda down to the tiles I had to use for a diagonal track which have this kinda shape but with the classic tiles it's sortof hidden so in game looks okay. You can still see it from above as shown below, but it's less clean and pronounced.
dirtDF.JPG
dirtDF.JPG (218.88 KiB) Viewed 6760 times
Non diagonal dirt tracks look fine, although you can see they appear a lot wider than with the default tiles - too wide in my eyes, almost filling the entire tile instead of only half.
dirt2.JPG
dirt2.JPG (324.26 KiB) Viewed 6760 times
I don't have enough understanding of what you're doing here to even conjecture what may be able to be done to make the splatmap version look more like the default shapes or to improve the road appearance. FYI cardinal tracks use double tile 11 and diagonal a combination of 12 and 51 to keep the path roughly the same width, rather than using a full block down the centre and half/half diagonals to fill in, which looks far wider than the cardinal tracks if I do that.

So, is there anything you can tweak in the splatmap code, or will I need to detect it and change the tiles I'm using? Or maybe its the hires tileset you're using? Is there any way for splatmapping the default tiles for comparison?
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: High Resolution Terrain Textures

Post by Nystul »

Hi TheLacus, here is some progress with the reflections mod and the splat map terrain shader.
I got it working. Still sorting out some bugs unrelated to your mod. So new version might take some more time.
Good news is that after fixing some issues reflections just work without the need to inject a different terrain shader variant for the splat map terrain shader. these are good news. I also like that ssr and planar reflections can be used together ;)
here is a screenshot of the current state (just planar reflections here):
Image

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

Re: High Resolution Terrain Textures

Post by pango »

Excellent! And I'm sure it looks even better in action :)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: High Resolution Terrain Textures

Post by TheLacus »

Hey Nystul, it looks great!
Hazelnut wrote: Fri Aug 28, 2020 1:37 pm Hi TheLacus, this looks great and after suggestion from MasonFace I took a look at the code and saw it's post processing the shader tilemap before using a new shader so i figured it would be compatible with the road painting into tilemap I'm using.. and it is. Roads look fantastic, but unfortunately as you can see in the screen below, dirt tracks look really derpy!
I think i can improve it by tweaking the height maps. Not sure if it will help much with the diagonal tiles, but we'll see. :)
Hazelnut wrote: Fri Aug 28, 2020 1:37 pm So, is there anything you can tweak in the splatmap code, or will I need to detect it and change the tiles I'm using? Or maybe its the hires tileset you're using? Is there any way for splatmapping the default tiles for comparison?
All textures (grass, dirt, road, etc.) are blended with a weight defined for each pixel in the splatmap, with additional logic to implement height-based blending. Daggerfall tiles are only replicated with this approach, it would look the same with classic textures.

A possible future improvement for compatibility would be to defines roads without relying on classic texture tiles. Specifically, we could use a matrix representing road position on terrain with a certain resolution (i.e. 4x4 for each tile). Each pixel would state if road texture should be blended at position, overriding the portion of texture from classic tile. That would make everything look like the straight track, no matter the direction.

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

Re: High Resolution Terrain Textures

Post by Hazelnut »

TheLacus wrote: Wed Sep 02, 2020 4:04 pm Hey Nystul, it looks great!
Hazelnut wrote: Fri Aug 28, 2020 1:37 pm Hi TheLacus, this looks great and after suggestion from MasonFace I took a look at the code and saw it's post processing the shader tilemap before using a new shader so i figured it would be compatible with the road painting into tilemap I'm using.. and it is. Roads look fantastic, but unfortunately as you can see in the screen below, dirt tracks look really derpy!
I think i can improve it by tweaking the height maps. Not sure if it will help much with the diagonal tiles, but we'll see. :)
Hazelnut wrote: Fri Aug 28, 2020 1:37 pm So, is there anything you can tweak in the splatmap code, or will I need to detect it and change the tiles I'm using? Or maybe its the hires tileset you're using? Is there any way for splatmapping the default tiles for comparison?
All textures (grass, dirt, road, etc.) are blended with a weight defined for each pixel in the splatmap, with additional logic to implement height-based blending. Daggerfall tiles are only replicated with this approach, it would look the same with classic textures.

A possible future improvement for compatibility would be to defines roads without relying on classic texture tiles. Specifically, we could use a matrix representing road position on terrain with a certain resolution (i.e. 4x4 for each tile). Each pixel would state if road texture should be blended at position, overriding the portion of texture from classic tile. That would make everything look like the straight track, no matter the direction.
Thanks for the reply. I think I will switch the dirt track diagonal tiles used if splatmap mod is detected then, although I'll wait and see what changes tweaking the heightmap gives. I think given the much better definition of the dirt tracks due to the splatting, that I could switch to a different diagonal pattern that would match the cardinal look pretty well.

The suggestion of matrix for road position on terrain sounds great for a proper road mod in the future. My basic roads mod is very simple and has many constraints including being limited to 8 directions. The whole idea is based on the tiles and map pixel design of the DF terrain system, however once a more complex and refined system is created where roads lead out from the actual gate positions and follow terrain heights etc that flexibility will be essential I expect.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: High Resolution Terrain Textures/Splat Terrain Texturing

Post by TheLacus »

Added Splat Terrain Texturing to miscellaneous files. It will eventually take the place of current version of the mod, probably when Daggerfall Unity 0.10.27 (?) is released.

It's pretty much the same build i already released here on forums, just with a few minor improvements. It doesn't include specific changes for reflections or roads, they will come with a future update.

User avatar
Midknightprince
Posts: 1324
Joined: Fri Aug 11, 2017 6:51 am
Location: San Antonio TX
Contact:

Re: High Resolution Terrain Textures/Splat Terrain Texturing

Post by Midknightprince »

TheLacus wrote: Thu Sep 03, 2020 8:11 pm Added Splat Terrain Texturing to miscellaneous files. It will eventually take the place of current version of the mod, probably when Daggerfall Unity 0.10.27 (?) is released.

It's pretty much the same build i already released here on forums, just with a few minor improvements. It doesn't include specific changes for reflections or roads, they will come with a future update.
Does it not work in 10.24 ?
I got it in mods but it's not showing up...
Check out my YouTube Channel!

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: High Resolution Terrain Textures/Splat Terrain Texturing

Post by TheLacus »

Midknightprince wrote: Fri Sep 04, 2020 12:39 am
TheLacus wrote: Thu Sep 03, 2020 8:11 pm Added Splat Terrain Texturing to miscellaneous files. It will eventually take the place of current version of the mod, probably when Daggerfall Unity 0.10.27 (?) is released.

It's pretty much the same build i already released here on forums, just with a few minor improvements. It doesn't include specific changes for reflections or roads, they will come with a future update.
Does it not work in 10.24 ?
I got it in mods but it's not showing up...
No, it requires Daggerfall Unity 0.10.25 as stated by file description. ;)

Post Reply