1024x1024 Terrain Textures?
-
Hello,
I was thinking of experimenting with AI upscaling on the terrain textures.
Does the engine support 1024x1024 H terrain textures? And if so, are the Terrain Editor (to repaint the paths) and Make Terrain (to regenerate fartiles) the only things I would need to touch after generating the new .dds files to replace the ones in \Data\TerrData\Korea\Texture\Texture_Polak?
Best,
Dodam -
I was thinking of experimenting with AI upscaling on the terrain textures.
Does the engine support 1024x1024 H terrain textures?
It does indeed support them.
And if so, are the Terrain Editor (to repaint the paths) and Make Terrain (to regenerate fartiles) the only things I would need to touch after generating the new .dds files to replace the ones in \Data\TerrData\Korea\Texture\Texture_Polak?
Neither would be required - simply replace the textures, you’re done. Fartiles are not a thing now.
-
Thanks - I’ve started downloading 1m satellite data from USGS. I think the Eastern US should be similar enough to Korea from having lived in both areas for a long time.
The idea is to:
- Downsample terrain imagery to 2m resolution;
- Teach the net to recover 1m resolution data;
- Let it take the 512x512 px and see if it can “recover” 1024x1024 data.
How are the lights handled in the .dds format? Also, are all colours allowed, or are we still limited to a 256 colour palette?
(The only guide I could find was this one, and I’m not sure how current this is: https://pmc.editing.wiki/doku.php?id=falcon4:textures#texture_tutorial)
-
How are the lights handled in the .dds format? Also, are all colours allowed, or are we still limited to a 256 colour palette?
The lights are a second DDS layer with the filename *N.dds - easiest way to advise is simply look at one in Photoshop, you’ll see very quickly how it is constructed. There is a very good script available to quickly generate night lights from the base tile. No limitations on colour count nowadays - each tile can have its own unique palette within DDS format constraints.
-
Thanks Malc - I took a look using GIMP, and I’m guessing the N tiles are just overlaid at night.
There is a very good script available to quickly generate night lights from the base tile.
Where is this script? Does it just look for something that looks like buildings? (I might just leave them as they are, or do a simple bilinear upsample to match resolution.)
Also, is the alpha value ever used, or is it safe to fill it with 255?
And here is the WIP (sorry about the resolution - I use 3 4K displays and I don’t know how this will show on other monitors):
L: Original 512x512 tile, upsampled to 1024x1024, nearest neighbour (so 1x1 px maps to 2x2 px)
Original 512x512 tile, upsampled to 1024x1024, bilinear interpolation (no extra information)
R: 1024x1024 tile, predicted by the network (I’m thinking AiTiles would be a good name as an homage to HiTiles / HiTilesAF)
Close-ups (32x32 patch from the original, 64x64 after upsample):
-
Yep, spot on. They are a simple overlay. The PS script uses higher intensity colours from the base tile, it does a pretty good job by default but as a result you tend to find, for example, roads are recreated as fully lit so manual touching up is required afterwards. It will give you a very good canvas to start with though. I’ll PM you a link once I get to my PC later.
Alpha isn’t used on night tiles, save them as DDS1, that’s all that’s required. Alpha IS used on terrain tiles to define water and is what gives you the reflective effect.
-
Results look decent enough
-
I’m probably 1/20th of the way in the training (4 hours out of ~80 planned), though I’m not sure how much better it will get.
I saw a post from 2019 using an off-the-shelf solution from Topaz for upsampling, but I figured this is a specific domain where good data is available, so something simple that’s purpose-built is bound to do better.
(The data that the upscaler is learning is based on ~500GB of NAIP data (~1,600,000 sq. km) east of the Appalachians - the code is something I’m writing for compressing electron microscope data, but my employer requires all code we write to be open-source so I can use it for the BMS community.)
I’ll probably have something ready for release in a few days. Once the neural net is trained, conversion should take less than 15 minutes, and should work for all theatres that have a similar (“leaf-on”) palette and terrain.
-
So an update on this for people who might be interested - I’ve been working on this the last two weeks:
USGS actually had High-resolution Orthoimagery at 1 ft resolution, so I have been training a new network to upscale to 2048x2048 (or 0.5m resolution) using an adversary (one network tries to come up with an upscale, the other network tries to figure out if an image is the original high-resolution, or if it’s been upscaled). The terrain looks significantly better, but I’m struggling with making runways and cityscapes look correct. Specifically, enforcing context (“there’s a brown rectangular patch next to what looks like roads and what looks like trees - is this a small field that’s the size of a large garden, or a house with a brown roof?”), and dealing with aliasing have been the main challenges. By aliasing, I mean that regular patterns like railways, farm plow lines, etc. are hard to recover correctly because many configurations at high resolution look exactly the same at low resolution. Here is an example:
TL: Original 0.5m resolution
TR: Upscaled 0.5m resolution
BL: Bilinear upsampled 0.5m resolution from 2m resolution
BR: Nearest upsampled 0.5m resolution from 2m resolutionChances are that something like this will not affect gameplay at all (especially since I’ll probably only release at 1024x1024), unless the stripes end up being runway thresholds pointing the wrong direction or something funky like that. I’ll release a beta (it’ll still have a lot of artifacts in places, that’ll likely go away with training) tomorrow if some of you want to test it. This is what it looks like at the moment:
L: Original, nearest neighbour upsampled
Original, bilinear upsampled
R: AiTiles 1m