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 sanchitcop19 · Jan 24, 2019 at 01:34 AM · terrainheightmaprawelevation

Understanding heightmap RAW imports

I have a real-world rectangular chunk of area (411m by 280m in real world units) whose heightmap I created using the following process (using python):

  1. I queried the individual elevation of each coordinate in the area I want by iterating from the starting latitude and longitude and increasing first the latitude by 0.0001 (I converted the floating points to integers first so although I increase the value by 1 the effect is that of varying the coordinate by 0.0001) and then the longitude in a basic nested for loop fashion. The dimensions of the matrix of elevation points I create is 38 by 36 since there are 38 different latitudes and 36 different corresponding longitudes.

  2. Once I have the elevation for each bounded coordinate, I divide the range (max elevation - min elevation) into 65536 (2^16) parts. For each elevation data point I find a numerical value between 0 and 65536 and color it accordingly, using shades of grey. As I understand, white represents higher elevation and black represents lower elevation. For example if lowest = 270 and highest = 285, I have a possible elevation array of the form [270, 270.00022, 270.00044.....] since 15/65536 ≈ 0.00022

  3. I export it as a PNG but I changed the extension to RAW since according to my understanding this is exactly how RAW files are encoded. Now I understand the image should be a power of 2 + 1 but I don't get how I can convert my 38 by 36 matrix into such an image while still preserving my goal of mapping real world elevation onto the terrain.

  4. I tried importing the heightmap in Unity on a terrain of size 411 by 280, 38 by 36, 380 by 360 and nothing gave me the effect I wanted.


I looked at the other answers but Im still not sure if my understanding of the process is correct. Could somebody point out the flaw in my process and give me any leads at all? My team and I have been stuck on this for a while and I don't see a solution in sight haha.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kaarloew · Jan 24, 2019 at 07:41 AM

RAW and PNG are different things. And file extensions are mostly for just people (actual code usually reads FourCC to determine the format of file).

Maybe https://unity3d.college/2017/07/17/importing-real-world-terrain-unity-free-terrain-party/ maybe that one helps with your project
AFAIK Unity doesn't support PNG files that have more that 8 bits per channel. https://forum.unity.com/threads/16-bit-png-shows-considerable-banding.527522/

Comment
Add comment · Show 1 · Share
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
avatar image sanchitcop19 · Jan 24, 2019 at 07:49 AM 0
Share

I did check that website out, I guess my use case is a little too specific haha. Thanks for the clarification! The python module I use only supports PNG, I guess I need to look elsewhere. Thanks again!

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

123 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Raw File / Heightmap Switch at Runtime 1 Answer

How to read raw files for custom terrain generation system? 0 Answers

Terrainmap is lined 1 Answer

why heightmap flips in terrain import raw(certain case)? 0 Answers

Generate 16bit terrain map from real world elevation data 3 Answers


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