Coder Social home page Coder Social logo

iwer / geotifflandscape Goto Github PK

View Code? Open in Web Editor NEW
63.0 6.0 12.0 95 KB

Unreal Engine Plugin to support geotiff as landscape file format.

License: MIT License

C# 5.37% C++ 92.58% C 2.05%
ue4 geotiff landscape unreal-engine terrain ue4-plugins ue5 ue5-plugin

geotifflandscape's Introduction

GeotiffLandscape - Unreal Engine Plugin

Adds geotiff files as Unreal Landscape height/weight map file type and custom data asset type. This can be used to generate real scale maps from existing locations. Geotiff digital elevation models (DEM) contain information about geo coordinates of the map and information about maximum and minimum elevation. With this information 1:1 scale Landscapes can be created using this Plugin. Also geotiff land cover files from the S2GLC can be imported to named landscape layers.

Compatibility

  • Unreal Engine 4 is supported at least with 4.27 (branch ue4, tag ue4.27)
  • Unreal Engine 5 is supported up to 5.1 (on master branch)

Features

  • Landscape Heightmap Fileformat Geotiff
  • Landscape Weightmap Fileformat Geotiff
  • Landscape Weightmap Fileformat S2GLC
  • Layered Landscape Material Example for S2GLC Layers
  • GeotiffHeightmap Asset with 16bit of height in red and green channels of a Texture
  • S2GLC Weightmap Asset with 12 gracscale layer maps

WARNING: This is experimental research code that will be subject of change.

This example was generated using a DEM from Opentopography and the corresponding section from S2GLC around this coordinates: 50.959057,14.061609. alt text alt text Landscape textures in the screenshots are from CC0textures and FreePBR. Foliage assets from NaturePackage (was free for April 2020 in UE4 Marketplace) and PN_FoliageCollection.

Cutbacks

DEMs are usually not available at high resolutions. The popular NASA SRTM GL1 data provides an average resolution of 30 meter per pixel while UE4 usually uses 1 pixel per meter for Landscapes. The low resolution geotiff texture is therefore scaled up using bi-linear interpolation to reflect their geo-spatial extends in UE4 scale (1 heightmappixel -> 1 meter of landscape). However artifacts of the low resolutions remain visible.

UE4 Landscapes usually support height differences of 655.33 meter. When the height difference of the geotiff is larger, the full range will be used to map the height values and a small yellow warning sign besides the filename suggest a Z-Scale to correct the scaling factor. This scale is best entered into the landscape z scale box before importing.

Building

This plugin uses GeoReference, UnrealGDAL, ue4cli and conan-ue4cli to build and manage the required GDAL libraries.

  • Download a Release of UnrealGDAL and place it in the Plugins directory or clone and follow instructions to build UnrealGDAL from source.

Usage

Add GeotiffLandscape to .uproject or .uplugin

"Plugins": [
  {
    "Name": "GeotiffLandscape",
    "Enabled": true
  }
]

Add build dependencies to your modules

PublicDependencyModuleNames.AddRange(
  new string[]
  {
    "GeotiffLandscape",
    "GeotiffLandscapeEditor"
  }
);

Landscape import

Landscape Heightmap import

In Landscape mode when importing a heightmap you will notice a new filetype "DEM Heightmap .tif files". Several checks are performed to ensure the file can be imported. In theory all projected geo coordinate systems with coordinates in meter containing a single Int16 or Float32 rasterband layer of gray-scale values in meters should work fine. Although it really does not make much sense to generate a landscape from a spherical projection it is also possible to import WGS48 references heightmaps. This can be usefull when geographic accuracy is not that important to avoid the effort of converting material.

Landscape Weightmap import

TIF files can be interpreted in two ways for weightmap generation.

Single layer weightmap

The obvious interpretion of the grayscale values is as one weightmap. The grayscale values are mapped to a range of 0 to 1 that represent the layer weight.

Multi layer weightmap

S2GLC provides huge landcover geotiffs for europe. Using the geo reference of the heightmap we can crop the area of interest into a smaller file. This is currently done in QGIS but may be integrated in the import process later. The gray scale values in this image represent 15 classes of landcover:

  • Clouds
  • Artificial
  • Cultivated
  • Vineyards
  • Broadleaf
  • Coniferous
  • Herbaceous
  • MoorsHeath
  • Sclerophyllous
  • Marsh
  • Peatbog
  • Natural
  • Snow
  • Water
  • NoData

For every class a landscape layer can be created (The layers are automagically created when using the LMT_S2GLCExample material for the landscape (except NoData and Clouds atm.)). This material also shows how to implement landcover dependent foliage using the Landscape Grass Tool. When importing the weightmap into the layer, the name of the layer has to match one of the landcover classes to select the grayscale from the S2GLC geotiff.

A special implementation interpretes distinct grayscale values as distinct weightmaps. The resulting weightmaps have a weight of 1 where the TIF pixel has the matching grayscale value and 0 where it has not.

To enable UE4 to distinguish between regular TIF weightmaps and S2GLC weightmaps, this plugin introduces the file extension *.s2glc. This is basically a *.tif file that is supposed to only have the 15 S2GLC grayscale values.

DataAssets

If you want to use render targets to generate the landscape at runtime you'll need all the height- and weightdata as textures and the geo reference metadata. For this purpose Geotiff heightmaps and S2GLC files can also be imported as DataAssets.

Geotiff Heightmap DataAsset

Geotiff heightmap assets contain the geo information and a texture2D where the 16 bit height values are split into the red and green channel of the texture. Because .tif files can also be imported as Texture without the geo reference information it is important to select the file type "Geotiff File (.tif)" when importing an asset into the content browser otherwise the pure texture import will be auto-selected.

S2GLC Weightmap DataAsset

S2GLC DataAssets contain a texture for each of the 15 layers (except NoData and Clouds) and the geo reference information.

Funding

Development of this code was partially funded by the German Federal Ministry of Education and Research (BMBF) under funding reference number 13FH1I01IA.

geotifflandscape's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

geotifflandscape's Issues

UE5 Compatibility

I'd like to use your plugin with Unreal 5.2.
Since your plugin uses UnrealGDAL, I tried to follow the information on the following github gist :
https://gist.github.com/iwer/fc4e34a2a491461d606d826b72664845

There are several things I didn't understand. For example, where are these scripts ?

./Setup.bat
./GenerateProjectFiles.bat

I tried other techniques to build UnrealGDAL but nothing worked. And I can't understand your gist. Would it be possible to have more information on how to compile your plugin and UnrealGDAL for UE5?

One solution would be to have UnrealGDAL precompiled for UE5. Do you still have this precompiled plugin? And if so, would it be possible to send it to me as a package?

which ue version

Which version should be used to run this plug-in? I used 4.25 to find that the content of the plugin cannot be loaded.

Request

Can you share a example project? Especially about runtime landscape generations i am interested very well can you help me?

modules missing error

I followed the instructions for usage (place plugin in engine plugins folder, write to .uproject and myproject.Build.cs), but I get the following error:
Missing modules: The following modules are missing or built with a different engine version:
GeoReference
GeotiffLandscape
GeotiffLandscapeEditor

I used engine version 4.25.4 on windows. UnrealGDAL plugin is enabled.
Am I missing something?

GDAL

Hi I wanna use your plugin but I could not use it becasuse of UnrealGDAL does not build and gives me the LINK errors I issued problem in github bu ı did not get a reply so please help!

Errors;

1>Configuration:
1>[settings]
1>arch=x86_64
1>arch_build=x86_64
1>build_type=Release
1>compiler=Visual Studio
1>compiler.runtime=MD
1>compiler.version=17
1>os=Windows
1>os_build=Windows
1>[options]
1>[build_requires]
1>[env]
1>UNREAL_ENGINE_VERSION=5.1
1>conanfile.py: Installing package
1>Requirements
1>    UElibPNG/ue4@adamrehn/5.1 from local cache - Cache
1>    gdal-ue4/2.4.0@adamrehn/5.1 from local cache - Cache
1>    geos-ue4/3.6.3@adamrehn/5.1 from local cache - Cache
1>    libcurl/ue4@adamrehn/5.1 from local cache - Cache
1>    libcxx/ue4@adamrehn/profile from local cache - Cache
1>    mergetiff-ue4/0.0.6@adamrehn/5.1 from local cache - Cache
1>    proj-ue4/4.9.3@adamrehn/5.1 from local cache - Cache
1>    ue4lib/ue4@adamrehn/profile from local cache - Cache
1>    ue4util/ue4@adamrehn/profile from local cache - Cache
1>    zlib/ue4@adamrehn/5.1 from local cache - Cache
1>Packages
1>    UElibPNG/ue4@adamrehn/5.1:e1e6b1738d0f221386689b1e26bf8a56d4d0bdcf - Cache
1>    gdal-ue4/2.4.0@adamrehn/5.1:07863f996ebe3271435d1fbbaed5ef30542fd710 - Cache
1>    geos-ue4/3.6.3@adamrehn/5.1:74f134025aabdec2e63aed248049f450e8e373f4 - Cache
1>    libcurl/ue4@adamrehn/5.1:e1e6b1738d0f221386689b1e26bf8a56d4d0bdcf - Cache
1>    libcxx/ue4@adamrehn/profile:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
1>    mergetiff-ue4/0.0.6@adamrehn/5.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
1>    proj-ue4/4.9.3@adamrehn/5.1:74f134025aabdec2e63aed248049f450e8e373f4 - Cache
1>    ue4lib/ue4@adamrehn/profile:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
1>    ue4util/ue4@adamrehn/profile:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
1>    zlib/ue4@adamrehn/5.1:e1e6b1738d0f221386689b1e26bf8a56d4d0bdcf - Cache
1>
1>Installing (downloading, building) binaries...
1>libcxx/ue4@adamrehn/profile: Already installed!
1>mergetiff-ue4/0.0.6@adamrehn/5.1: Already installed!
1>ue4lib/ue4@adamrehn/profile: Already installed!
1>ue4util/ue4@adamrehn/profile: Already installed!
1>UElibPNG/ue4@adamrehn/5.1: Already installed!
1>geos-ue4/3.6.3@adamrehn/5.1: Already installed!
1>libcurl/ue4@adamrehn/5.1: Already installed!
1>proj-ue4/4.9.3@adamrehn/5.1: Already installed!
1>zlib/ue4@adamrehn/5.1: Already installed!
1>gdal-ue4/2.4.0@adamrehn/5.1: Already installed!
1>conanfile.py: Generator txt created conanbuildinfo.txt
1>conanfile.py: Generator json created conanbuildinfo.json
1>conanfile.py: Aggregating env generators
1>conanfile.py: Generated conaninfo.txt
1>conanfile.py: Generated graphinfo
2>Using bundled DotNet SDK version: 6.0.302
1>Library 'gdal.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Library 'geos.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Library 'geos_c.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Library 'proj_4_9.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Library 'libcurl.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Library 'libpng15_static.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
1>Library 'zlibstatic.lib' was not resolvable to a file when used in Module 'GDAL', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
2>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -Target="UnrealEditor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild
1>Building GISEditor and ShaderCompileWorker...
1>Using Visual Studio 2022 14.37.32825 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Determining max actions to execute in parallel (6 physical cores, 12 logical cores)
1>  Executing up to 6 processes, one per physical core
1>Building 6 actions with 6 processes...
1>[1/6] Copy geos_c.dll
1>[2/6] Copy geos.dll
1>[3/6] Compile Module.UnrealGDAL.cpp
1>[4/6] Link UnrealEditor-UnrealGDAL.lib
1>   Creating library C:\Users\sguney\Documents\Unreal Projects\GIS\Plugins\UnrealGDAL-master\Intermediate\Build\Win64\UnrealEditor\Development\UnrealGDAL\UnrealEditor-UnrealGDAL.lib and object C:\Users\sguney\Documents\Unreal Projects\GIS\Plugins\UnrealGDAL-master\Intermediate\Build\Win64\UnrealEditor\Development\UnrealGDAL\UnrealEditor-UnrealGDAL.exp
1>[5/6] Link UnrealEditor-UnrealGDAL.dll
1>   Creating library C:\Users\sguney\Documents\Unreal Projects\GIS\Plugins\UnrealGDAL-master\Intermediate\Build\Win64\UnrealEditor\Development\UnrealGDAL\UnrealEditor-UnrealGDAL.suppressed.lib and object C:\Users\sguney\Documents\Unreal Projects\GIS\Plugins\UnrealGDAL-master\Intermediate\Build\Win64\UnrealEditor\Development\UnrealGDAL\UnrealEditor-UnrealGDAL.suppressed.exp
1>libcurl.lib(version.obj) : error LNK2019: unresolved external symbol nghttp2_version referenced in function curl_version_info
1>libcurl.lib(http2.obj) : error LNK2001: unresolved external symbol nghttp2_version
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_new referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_del referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_send_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_frame_recv_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_data_chunk_recv_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_stream_close_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_begin_headers_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_on_header_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_callbacks_set_error_callback referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_client_new referenced in function Curl_http2_setup
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_del referenced in function http2_disconnect
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_send referenced in function http2_conncheck
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_mem_recv referenced in function h2_process_pending_input
1>libcurl.lib(http2.obj) : error LNK2019: unresolved external symbol nghttp2_session_resume_data referenced in function Curl_http2_done_sending

UE4.27

Having trouble compiling for UE4.27 can you please advise?

Program crash problem

Hi, thank you for sharing. But I have a problem. Can you give me some suggestions?

When I import an image, an error will appear after executing the following functions:

FLandscapeHeightmapInfo FLandscapeHeightmapFileFormat_Geotiff::Validate(const TCHAR* HeightmapFilename) const

Unhandled exception at0x00007FFF056515EF (UE4Editor-GeotiffLandscapeEditor.dll) (UE4Editor.exe 中): 0xC0000005: Write into 0x000001DA568CACC0 An access conflict occurred。


Have you ever encountered this problem?
Or can you tell me which part of the code should be executed after the function is executed under normal circumstances?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.