Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by rhood666 · Mar 10, 2017 at 07:15 AM · terrainimportscaleheightmapheight

Problem with heightmap and terrain height maxing out at 10000, proportions *Solved*

I will be the first one to recognize that I'm a n00b by all means but I generally am able to work around most problems on my own. However not this time.

I'm trying to import a real world terrain heightmap into unity and I have a problem with "scaling" it to the right proportions. The heightmap I'm using is originally a 32 bit (1025x1025 pixel) geotiff provided by the Norwegian Polar Data Center that I, in order to be able to use, have processed with the following line of code through gdal to maket it a 16 bit RAW file, which for some reason seems to work better than saving it as a 16-bit RAW file from photoshop (which hasn't worked for me at all):

 gdal_translate –ot UInt16 –scale –of ENVI –outsize 1025 1025 P5.tif heightmap5.raw

I have no problem importing this RAW file into unity, however after import there seems to be an issue with proportions. The side of the original tif that I'm using in the real world is equal to about 5.2km and I would like it to be that measurement in the game world aswell, however in order for me to even see the terrain I, for a terrain with a width of 500 and length of 500 (which isn't nearly a 10th of what I would like), have to set the Terrain height to 10000 which is the maximum. And, I should say 10000 isn't near the real max height of the terrain which is more like 700 meters or so. So after tinkering around a bit I'm figuring that in order to get the side of my heightmap in the game world to match the length of the heightmap in the real world I would need to increase the terrain height well beyond 10000. I'm figuring this has got to do something with ratio between terrain height and width/length of the terrain since I'm able to scale it all down to smaller measurements (approx 10x10 widthxlength and 30~something) and still maintain what looks like the right proportions?*

So my question is:

How do I work around this? What is at fault? Is there some way to manipulate the heightmap so that the height-span in the map better equals the proportions of the real world?

And please remember I'm a n00b, so please explain accordingly! Oh and I would be greatful if you do have other general tips and tricks for me!

Cheers! And thanks in advance!

*I'm adding a picture (since it won't let me upload the tif) of the original heightmap (.tif) and a screenshot of the terrain in Unity where you can also see the settings, just to prove I'm not lying:

UPDATE 1 I'm starting to think the issue is that when converting the tif to a 16-bit RAW using the -scale command it automatically scales the height data in the tif to a range from 0-65535 (highest 16-bit number). Tips on how to counter this or other workarounds are welcome!

UPDATE 2 Solved Turns out I was right! And even solved the issue before this post has been moderated! It was the 16-bit conversion that was the problem! So I converted the 32-bit to 8-bit instead using:

 -ot Byte

In gdal instead of

 -ot UInt16

This solved the issue, since the height data then instead of 0-65535 scales to 0-255, more than enough headroom to scale my terrain as I like! Planning to leave this here in case someone else encounters the same problem.

[1]: /storage/temp/89605-p5.png

[2]: /storage/temp/89606-game.png

game.png (454.2 kB)
p5.png (14.7 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Controlling height when importing heightmaps 1 Answer

Import RAW height map not working 0 Answers

How to use Height Maps 2 Answers

Best way to get terrain positions from a given height range 2 Answers

Importing Heightmaps 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges