How to read landscape height map data from C++
I would like the read the height map data of the editor initialized landscape (in C++) so that I can pass the data to our server application which internally handles physics.
But I could not find a satisfactory method of doing it. And I have many questions.
I've retrieved the the only ALandscape instance (the landscape) in my scene and iterated over its ULanscapeComponents. At each landscape component there is the HeightMapTexture variable which supposedly holds the data.
I've adapted the following code from the Import method that resides inside LandscapeEdit.cpp...
landscape is the instance of the ALandscape actor class which I've retrieved from the scene. The problem here is that the heightMapData array entries does not make any sense when I check them in debug mode and Visual Studio shows some weird text characters in place of the RGBA channels of the FColors.
How does Unreal store height map of a landscape internally? Is it an 16 bit greyscale image encoded in two channels (8 bits * 2). If that is so which channels.
How to decode and properly access this data in general?
Thanks in advance for answers.
asked May 03 '17 at 02:10 PM in C++ Programming
I've answered my own question in another post:
answered May 12 '17 at 04:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here