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 MPink · Aug 09, 2011 at 03:47 PM · terrain

Terrain Generation Problem

Good afternoon people.

Im trying to generate Terrain maps from textures using code. After some reading ,some hair pulling and a bit of tinkering i managed to produce terrains i was happy with.

Then i put together a test WebPlayer to check that every thing was working ok and ran into a problem. Im not sure what the exact word for it is but its related to basemapDistance and i can only describe it as a texture error.

Time for some images alt text alt text When in the WebPlayer mode the terrain loses its texture when the distance becomes greater than basemapDistance. This also happens in PCStandalone mode. In the editor (top image) it works fine though with the heights and textures all reducing there resolution as you move away.

I can only assume there is a difference in one or more default values of some objects or that the editor has been nice enough to fix something silly that i have missed and not bother telling me about it.

Relevant Code Chunk Debug.Log("-----Building Terrain Data-----"); processing_state++; if (gui_text) { gui_text.text=processing_text[processing_state]; yield WaitForSeconds(0);; } this.terrain_data = new TerrainData();

 this.terrain_data.splatPrototypes = splats;
 
 this.terrain_data.SetDetailResolution (1024,tile_size);
 this.terrain_data.heightmapResolution = res;
 this.terrain_data.alphamapResolution = res;
 
 this.terrain_data.SetHeights(0,0,this.h_map);

 this.terrain_data.SetAlphamaps(0,0,this.a_map);

 this.terrain_data.size = new Vector3 (tile_size*res,max_height,tile_size*res);
 
 this.terrain_data.RefreshPrototypes();

Debug.Log("-----Building Terrain-----"); processing_state++; if (gui_text) { gui_text.text=processing_text[processing_state]; yield WaitForSeconds(0);; } Terrain.CreateTerrainGameObject(this.terrain_data); Terrain.activeTerrain.treeDistance = 5000; Terrain.activeTerrain.treeBillboardDistance = 1000; Terrain.activeTerrain.treeCrossFadeLength = 20; Terrain.activeTerrain.treeMaximumFullLODCount = 0;

 Terrain.activeTerrain.detailObjectDistance = 0;
 Terrain.activeTerrain.detailObjectDensity = 0;
 
 Terrain.activeTerrain.heightmapPixelError = 25;
 Terrain.activeTerrain.heightmapMaximumLOD = 1;
 Terrain.activeTerrain.basemapDistance = 450;
 Terrain.activeTerrain.castShadows = false;
 
 Terrain.activeTerrain.Flush();

Hope someone can point me in the right direction. Thanks in advance, Mike

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
Best Answer

Answer by MPink · Aug 10, 2011 at 04:27 PM

Solved It.
But if i run into another problem like this i fear i may end up bald.

The problem was that the textures i was using in my splatPrototypes had been loaded using Resources.Load("Grass (Hill)") And they had not had there Read/write Enabled checkbox checked (in advanced settings for the texture importer).

Im still confused as to how this has fixed things but it did.
I would have thought if it wasnt checked then Resources.Load should fail but as its something to do with reducing LOD i could just understand it only failing when i started playing with basemapDistance.
What i cant understand is why there is why the Editor and StandAlone players produce different results :?

Comment
Add comment · 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

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

2 People are following this question.

avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How to generate random terrain like platforms for a 2.5D game. 0 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

Possible Infinite Terrain Plane? 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