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