Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 raxter · Jul 19, 2012 at 03:05 AM · terrainheightmapsmoothing

Smoothing Terrain after setting its Heightmap in a script

I have a terrain and I manually set the heightmap of it in a script at runtime. It is a little blocky (I cannot get more detailed heightmap data). I notice that I can smooth the map using the unity editor, and that this smoothness is of a higher resolution than the terrain heightmap (or at least a higher resolution than I have control over using the terrain.terrainData).

So it currently looks like this: alt text

but I want it to look like this alt text

which is what happens when I do a quick smooth brush on the terrain in the unity editor whilst the game is running.

I have to reload the heightmap data from a file every time the game runs and there is no way for me to smooth the terrain and export it from unity and then reload it (I could, but I'm using real world height data so I don't want to smooth the entire world's heightmap! :p)

Is there no way I can smooth the terrain's heightmap data from a script in a similar way to the way unity's terrain editor can? I don't understand enough about the terrain's inner working, nor any way to edit them to do this currently. It should be possible for me to smooth the heightmap at runtime using a similar gaussian blur of some form in a script, shouldn't it?

Any help would be greatly appriciated, many thanks.

blocky_terrain.png (173.3 kB)
smoothed_terrain.png (131.0 kB)
Comment
Add comment · Show 3
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 ozzyonfire · Jul 10, 2013 at 07:30 PM 0
Share

I am also having the same issue! Were you able to find a solution?

avatar image Benproductions1 · Jul 11, 2013 at 06:10 AM 0
Share

Ins$$anonymous$$d of smoothing the terrain, for which there is no easy way, you have to do it yourself (script or otherwise), I suggest you take your heightmap, scale it up so it matches the terrain, and then smooth that out, which is much easier

avatar image raxter · Jul 11, 2013 at 07:04 AM 0
Share

I wasn't able to, there seems to be no way to smooth terrains that you initially set in runtime. However if I had to approach it again, I'd probably build my own mesh from scratch and smooth that. Or as benproductions suggests, set the height in groups of 4 (2x2) or 9 (3x3) and smooth that, but then you might as well investigate making a mesh (which was too hectic for me when I first wrote the post but with a bit of effort they aren't that scary now :p)

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

8 People are following this question.

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

Related Questions

Export terrain from Cinema4d to Unity3d 1 Answer

How to use Height Maps 2 Answers

Edit Terrain Script 0 Answers

Randomized terrain? 0 Answers

Stitching grid of terrains together 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