I just want to make some temporary terrain and for that purpose I go in photoshop, create a new 1024x1024 16bit, greyscale image. I then render clouds, do some manipulation on it and save it as a raw file (macintosh format).
When I import heightmap in unity using the raw file above it imports almost fine except there are always jagged edges (as tall as the max height of the terrain) on two of the edges of the terrain.
Here is a screenshot of what happens...
Any idea what I can do to stop this from happening? It is terribly timeconsuming to flatten those areas out using the flatten height tool. Is there some other way of fixing it?
Answer by aaron parr
Nov 01, 2009 at 03:48 PM
The resolution of your heightmap needs to match that of the "Heightmap Resolution" field. Your screenshot shows a heightmap resolution of 2049, and yet you are supplying a 1024x1024 heightmap. You can fix this in a couple ways:
Optimally you would first set this resolution when you create the terrain asset in Unity, second, create a heightmap with the correct resolution, and third, import the heightmap.
Also, the heightma resolution clamps to specific sizes. You can not set it to 1024. If you enter that number into the field it will result in 1025. Resolutions of heightmaps follow the classic pattern of x+1, where x is a doubling number following this pattern: 2, 4, 8 etc... So heightmap resolutions are numbers like 257, 513, ,1025, 2049.
For an in depth explanation of Terrain Assets see the reference section of the documentation: http://unity3d.com/support/documentation/Components/terrain-UsingTerrains.html
Thanks. I figured out that I need to make sure the heightmaps I am making are x+1 width and height in pixels as you mentioned above and that solves the issue.
Answer by zumwalt
Dec 04, 2009 at 10:45 PM
You want to see something really cool, open Photoshop (any flavor) create a height map /map, click file, save as, choose RAW, save the file, make sure you put a solid white number 1 in the upper left of the map image so that it stands out on the terrain, also make sure that when you do this save, you choose Non-interleaved order, otherwise the map is all screwy on import, see on Photoshop CS4 and even Photoshop 7, File Type is greyed out as PRAW and File Creator if greyed out as 8BIM, header is set to 0 by default. Ok, now in Unity, create a new blank terrain and import height map, choose the RAW exported file and apply it, you will now see that the terrain is horizontally flipped, verticaly flipped, and inverted, so Unity is improperly importing RAW heightmaps, you have to flip the item in Photoshop horizontally, the flip it vertically then import it into Unity, otherwise you will not be able to import it at all and have it correct.
Answer by JoeW
Feb 01, 2010 at 09:44 PM
If you're getting a "lip" on your terrain, what might fix it is to switch your Byte Order (in your RAW export dialog in Photoshop) from Mac to Windows - and do the same when importing your map. I've found that using Mac byte order will give you that annoying "lip"
Answer by MSylvia
Oct 31, 2009 at 09:26 PM
Some of your numbers don't match up. The terrain resolution is 2000x2000 with a height map resolution of 2049. Your texture is only 1024x1024. How wide is the area of the error?
It could be because the resolution of the height map is 2049 instead of 2000 or the resolution of the terrain has to match the texture.
Answer by zachypin
Nov 17, 2011 at 08:05 PM
I see this is answered, but I keep getting directed here with my Google queries, so I figured I'd throw in what I've been searching for, for a while.....
I took a raw file from OpenSim and wanted to import it into Unity3D. Had the same jagged edges in the picture above, except it was the entire terrain. Problem was that the raw was RGB, and Unity only works with greyscale. I'm currently looking for a converter, asking if anyone knows about one here: http://answers.unity3d.com/questions/187059/convert-rgb-heightmap-to-greyscale.html?viewedQuestions=7652&viewedQuestions=8574.
"Had the same jagged edges in the picture above, except it was the entire terrain."
As did I. Turned out it was because I was leaving the "Byte Order" import setting as "Windows" when it needed to be set to "Mac" for that particular .raw file.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
3 People are following this question.
How to use Height Maps
Photoshop heightmap chunks not lining up
I Have A Problem Importing A Map From Blender
Controlling height when importing heightmaps