- Home /
Is there a definitive explanation for generating and importing raw heightmaps?
I have been trying to update the heightmap on one of my terrains for hours. It is the first time I have tried to do this since upgrading from unity 3.5.7 to 4.2.1. The method I used to generate heightmaps using 3.5.7 doesn't seem to create something that will work under 4.2.1. My basic process is I have a perl script that extracts a numeric raster of elevation values from a large elevation data set, then, in Matlab I use those values to create a gray scale image of the data. I then pull that image into Photoshop, scale it to the proper size for the terrain, flip it as necessary for raw import to unity, and save in raw format. Previously this worked fine. The generated images look just like they always have. But, now instead of getting sizes in the import window they are reported as width and height of 1, though the files are not near 0 size and can be read back into Photoshop.
I have seen mentions of defining maps to be x+1, z+1 relative to the terrain x, z size. This didn't seem necessary under 3.5.7 and I just defined the maps to be the same size as the terrain. I have tried the +1 sizes with 4.2.1 and when I import the map I get an error that an array is not large enough.
I've hit about every permutation I can think of in trying to import a new heightmap, (including trying to save the raw file out in a program other than Photoshop, XnView (which BTW worked under 3.5.7)). But, no joy. Any heightmap pointers would be much appreciated!
"definitive explanation" .. answer is sadly probably "No :/ "
Answer by waterdog · Sep 27, 2013 at 08:52 AM
OK...answering my own question again... Though this isn't really an answer, just a functional solution...;^) I do not understand why it works, and really would appreciate someone who knows what's going on with heightmaps chiming in...please?!!
Anyway, I tried setting the width and height in the raw import window from their reported sizes of 1 to the size of the image the raw file was generated from (1024 x 512) and it imported, except it was something like a repeat of 4 instances of the heightmap checkerboarded on the terrain. I looked back at what happened with the heightmaps under 3.5.7 and they did report sizes other than 1, but, for a heightmap generated from a 1024 x 512 image, they report a size of 512 x 512. So, I tried setting the sizes in the import window to 512 x 512 and my originally 1024 x 512 image based raw image imported properly onto my 1024 x 512 terrain.
I haven't a clue... I'm too tired to care...;^)
Anyone who can come up with an explanation, I really would like to see it!
Your answer
Follow this Question
Related Questions
Cant Import Photoshop RAW 0 Answers
How can I import terrain from DXF? 1 Answer
Heightmaps not importing properly 0 Answers
Photoshop heightmap chunks not lining up 0 Answers
Imported image quality; changed color? 2 Answers