Page 3 of 9

Re: High Resolution Terrain Textures

Posted: Thu Jul 09, 2020 9:37 pm
by TheLacus
No ETA or promises on the final result, but i'm working on terrain texturing using splat maps. The advantage of this approach is that is should remove or alleviate almost any kind of bad tiling or misplacement. Of course this is only for modded textures, the current solution does a great job at recreating original Daggerfall terrain.

For those unaware, Daggerfall terrain is composed of tiles: there are a few main materials (grass, mud/ground, water) and a bit less than 60 textures for transitions (i.e. half grass - half ground). They are combined to create a specific terrain layout, but the result is not always perfect and you can tell if you play with high resolution screen and textures.

Texture splatting is a more modern approach. As a start, the following screenshot was taken with only grass and ground full tiles, plus a recreation of half-half transition. All predefined transitions need to be recreated with this approach.

EDIT removed old screenshots

Re: High Resolution Terrain Textures

Posted: Fri Jul 10, 2020 12:17 am
by MasonFace
Excellent! I wish I had time to pursue my heightmap blended splatmap shader, but I got bogged down trying to figure out how to convert the generated tilemap into splatmap.

What are the white sections in your pictures? Oh I see, the white parts are the sections of the splatmap where tilemap transitions haven't been created yet.

Also, are you limited to just four textures corresponding to the splatmap's RGBA channels or are you doing a multi-pass approach?

The transitions look fantastic. Thank you for pursuing this!

Re: High Resolution Terrain Textures

Posted: Fri Jul 10, 2020 10:36 am
by King of Worms
Im also very glad you still working on this, as I was not able to add normal maps on my own.

Only - quite major - issue I had with this mod when I tested it few month back was, that the textures are too bright. It looks ok until the sun is full, than its way too much and I reverted back to my textures.

This can be corrected tho, no big deal. Im looking forward to the new splat map shader.

Re: High Resolution Terrain Textures

Posted: Sat Jul 11, 2020 3:24 pm
by TheLacus
MasonFace wrote: Fri Jul 10, 2020 12:17 am Excellent! I wish I had time to pursue my heightmap blended splatmap shader, but I got bogged down trying to figure out how to convert the generated tilemap into splatmap.

What are the white sections in your pictures? Oh I see, the white parts are the sections of the splatmap where tilemap transitions haven't been created yet.

Also, are you limited to just four textures corresponding to the splatmap's RGBA channels or are you doing a multi-pass approach?

The transitions look fantastic. Thank you for pursuing this!
Hi!

It's mostly a manual process of creating corresponding alpha maps for all tiles. It's quite boring, but it should be a one-time process. I'm using a resolution of 512x512, which means that each tile has 4x4 pixels of splatmap. I'm storing this information inside an array of floats for every layer, organized as an atlas of 4x4 matrices, one for each tile, with the same layout as the tilemap atlas (only one of the four rotations). It's simple enough to parse visually and make changes and has been enough to get me started by filling it with 0.25f, 0.75f and so on. Many tiles reuse the same pattern so i'll probably migrate to a different approach eventually. It will also be simple enough to export this data as greyscale textures for further edits, if i make the jump to 8x8.

During terrain promotion, the tilemap is used to create a splatmat on the C# side using the float atlas/matrix (with the required rotation), which is then assigned via Unity API. I'm relying on the built-in shader, at least for the moment. It supports multi-passes so i'm not worried about that, what it really misses is height blending. It's actually supported on HDRP and URP pipelines, but not by the shader for the default pipeline. This alone makes your approach a very interesting one! I don't think is a top priority, but maybe the idea will come back in the future.

Re: High Resolution Terrain Textures

Posted: Sun Jul 12, 2020 1:06 pm
by TheLacus
King of Worms wrote: Fri Jul 10, 2020 10:36 am Im also very glad you still working on this, as I was not able to add normal maps on my own.

Only - quite major - issue I had with this mod when I tested it few month back was, that the textures are too bright. It looks ok until the sun is full, than its way too much and I reverted back to my textures.

This can be corrected tho, no big deal. Im looking forward to the new splat map shader.
Thanks. I believe is related to gamma vs linear but i haven't properly investigated this yet.

Re: High Resolution Terrain Textures

Posted: Sun Jul 12, 2020 1:30 pm
by pango
This looks really good!
Could it be possible to add some noise in the alpha maps? I imagine that at the border of, say, grass and road, you'd find patches of grass/road that deviate from the theoretical straight frontier.
I assume the difficulty would be to make that noise also tile seamlessly...

Re: High Resolution Terrain Textures

Posted: Sun Jul 12, 2020 7:40 pm
by King of Worms
Looks great with this light! Yes I hope we get that new lighting some day. Gamma vs linear it is. Than I switch to your version for sure.

Have u tryed to match/compare the brightness/saturation to originals? Originals are quite dark actually.

Re: High Resolution Terrain Textures

Posted: Tue Jul 14, 2020 9:25 pm
by TheLacus
pango wrote: Sun Jul 12, 2020 1:30 pm This looks really good!
Could it be possible to add some noise in the alpha maps? I imagine that at the border of, say, grass and road, you'd find patches of grass/road that deviate from the theoretical straight frontier.
I assume the difficulty would be to make that noise also tile seamlessly...
This is a valid point, right now edges are very uninteresting. I'll see what i can do, but resolution of the splatmap is the limit and i wouldn't want to increase it too much.


I changed idea on height blending and decided is worth to work on it before doing further improvements to alpha maps.
I edited the standard terrain shader to read height information from the alpha channel (created as greyscale of main textures) and use it for blending. I think the result it promising, at least for solid materials.

Re: High Resolution Terrain Textures

Posted: Fri Jul 17, 2020 12:59 pm
by MasonFace
The height blending looks fantastic!

I really think this splatmap technique is going to make certain types of future mods such as Roads of Daggerfall much easier and better looking, since they should be able to simply draw lines or bezier curves onto the splatmap to draw roads or dirt paths.

Re: High Resolution Terrain Textures

Posted: Fri Jul 17, 2020 1:58 pm
by DigitalMonk
TheLacus wrote: Tue Jul 14, 2020 9:25 pm I'm not really happy with water. It looks great up-close, but i can't fully avoid the "floating" look from a distance...
Water is hell to display, and really needs pixel shaders to pull off. Looking at it from a distance, you'd have to support mixtures of reflection (sky, nearby objects) and refraction (you'd tend to see the the far shore tinted slightly "projecting" quite a ways out into the body of water). Not sure how to even approximate that with a flat texture replacement...

OTOH, the height-map-based blending is awesome! Stuff from the nearby surfaces collects in the pockets of the material, just like it would. Brilliant idea!