manticorp / unrealheightmap

Unreal Engine 16 Bit Grayscale PNG Heightmap Generator
MIT License
18 stars 1 forks source link

Feature: Generate terrain texture for the landscape #3

Closed teddybee closed 1 year ago

teddybee commented 1 year ago

It would be nice to have a possibility to generate an albedo texture as well (for example google maps terrain or similar), with the possibility of 2K-8K resolutions choice.

manticorp commented 1 year ago

This is a brilliant idea - I thought it would be pretty easy, but actually is a bit more difficult than first thought.

Might take a while to add this feature.

manticorp commented 1 year ago

This should be implemented now! Let me know what you think.

I'm limited by types of map layers I can use, becuase of the availability of them and their licenses.

It exports an image based on the current view in the map at the top of the page.

teddybee commented 1 year ago

Thank you for the effort. Its working, but not good. Unreal textures needs to be divided by 8 or 16. Texture resolution should be distinguished from the map size. That's why I suggested 2048, 4096, 8192 choice for that. But this could be used to color vertexes on map.

teddybee commented 1 year ago

With QGIS or ArcGIS softwares, you can download terrain images by gps rectangles, but I don't know anything about the licences, usability. P.S: also can be good with scraping https://earthexplorer.usgs.gov/ https://www.usgs.gov/faqs/are-usgs-topographic-maps-copyrighted

manticorp commented 1 year ago

Hmm...in this case, you can just enter custom values in the width/height box?

The problem comes becuase, to avoid resampling of the original data, the heightmap data is exported at an integer zoom level, so that the source tile image is used 1:1 to create the heightmap/albedo texture.

To be able to map that same area in a different pixel size, you would need to resample the image ever so slightly (e.g. from 8129 to 8192, or 253 to 256).

My advice would be to just use custom values for the height/width (e.g. 8192 instead of 8129) and use that as the texture, even though the data won't be quite aligned.

The error will be quite small, and most pronounced at the edges.

The alternative being resampling the image slightly using image editing software, which might not be so bad, but generally...small amounts of resampling noticeably soften images. You could always use AI upscaling, although for textures this large it would be very difficult!

Otherwise, there is not really much I can do I'm afraid.

manticorp commented 1 year ago

I have added USGS data, but it's not available at high res everywhere.

You can view list of easy to add providers here:

https://leaflet-extras.github.io/leaflet-providers/preview/

teddybee commented 1 year ago

This can be an alternative, looks promising. https://agromonitoring.com/api/images Although, in the free tier: "Number of created polygons per month < 10"

teddybee commented 1 year ago

Google earth has an api. It has a very good resolution of images. The images are free to use in non-commercial projects(if I read correctly). https://developers.google.com/earth-engine/guides/exporting https://developers.google.com/earth-engine/reference/rest