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 mullencm · Jul 12, 2012 at 11:29 PM · terraintilesgis

Terrain Tile Seams and Terrain.SetNeighbor

Overview

Via a Unity Editor script, I am loading a GIS elevation GRID via a header txt file and binary float file. I am reading the large data set, choosing the nearest power of 2 and filling a corner with the real data. Then I break the large data set in to 513x513 terrain chunks and create the Terrains and gameObjects.

I am getting LOD seams between the TerrainChunks but only after starting the simulation, just after creating the tiles in the editor and before pressing play I can see that the terrain.setNeighbor() is working correctly. But pressing play and going into game mode changes that and the seams can be seen, after stoping the game simulation the terrain chunks continue to not respect the neightbors LOD.

Relevant Code

 for( int y = 0; y < numberOfChuncks; y++ )

{ for( int x = 0; x < numberOfChuncks; x++ ) { Terrain left = null; Terrain top = null; Terrain right = null; Terrain bottom = null;

// Terrain Tile layout

// (x,y)

// (0,2)(1,2)(2,2)

// (0,1)(1,1)(2,1)

// (0,0)(1,0)(2,0)

//TOP

if( y == numberOfChuncks - 1 ) top = null;

else top = terrainObject[x,y+1].GetComponent();

//BOTTOM

if( y == 0 ) bottom = null;

else bottom = terrainObject[x,y-1].GetComponent();

//LEFT

if( x == 0 ) left = null;

else left = terrainObject[x-1,y].GetComponent();

//RIGHT

if( x == numberOfChuncks - 1 ) right = null;

else right = terrainObject[x+1,y].GetComponent();

//MAKE IT SO

terrainObject[x,y].GetComponent().SetNeighbors( left, top, right, bottom ); terrainObject[x,y].GetComponent().heightmapPixelError = 2; } }

Questions

Do I need to update Terrain.setNeighbors per frame? Is the fact that this is a Editor Scrip restricting the neighbors to only the editor window?

Thanks Chase

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
1

Answer by Bunny83 · Jul 13, 2012 at 12:23 AM

You certainly don't need to call it every frame, but i'm not sure if the neighbor information is stored in the terrain asset. You might need to call setNeighbors in Start()

edit

I just had a look into the Terrain script and, as i guessed, the neighbor-variables aren't serialized:

     [NonSerialized]
     private Terrain m_LeftNeighbor;
     [NonSerialized]
     private Terrain m_RightNeighbor;
     [NonSerialized]
     private Terrain m_BottomNeighbor;
     [NonSerialized]
     private Terrain m_TopNeighbor;

So you need to setup the neighbors at runtime. One way is to store the terrain list in a custom script along with the terrains and have it's Start method setting the neighbors.

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 mullencm · Jul 13, 2012 at 02:35 PM 0
Share

I will give that a try.

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

Make a simple tree 1 Answer

Tile Terrain Generation 1 Answer

how to dispatch textures as tiles in one terrain 0 Answers

which one is more efficient on Android Tiles or a Terrain. 0 Answers

How do I SetNeighbors() for terrains before I put them in an AssetBundle? 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