- Home /
Terrain: Increase base map distance over 2000?
I have a very low-res terrain that is very large (4 kilometers per side). It doesn't need higher resolution heightmap because it is low rolling hills. So I want the performance boost of having a low resolution terrain, but with high res textures.
Unfortunately, the base map distance seems hard-capped at 2000, which means everything in the distance looks awful. I want to increase the terrain base map distance to ~5000.
NOTE: Terrain.activeTerrain.basemapDistance = 5000; Does NOT work cause unity auto-resets your changes (same with unity grass maxed at 250 meters).
See this: http://answers.unity3d.com/answers/556006/view.html doesn't work anymore
Can anyone help solve this issue?
Alternatively if you reduced the size of everything to 1/10th, the 2000 size would seem like 20,000 :P
Answer by wartimespark · Dec 01, 2014 at 04:20 AM
if (Terrain.activeTerrain.basemapDistance != 20000)
{
Terrain.activeTerrain.basemapDistance = 20000;
}
Placed in the update works. Kinda sad.
using UnityEngine;
[ExecuteInEdit$$anonymous$$ode]
public class BasemapDistanceSet : $$anonymous$$onoBehaviour
{
public float BasemapDistance = 2000;
private Terrain terrain;
void OnEnable ()
{
terrain = GetComponent<Terrain> ();
#if UNITY_EDITOR
UnityEditor.EditorApplication.update += Set;
#endif
}
#if !UNITY_EDITOR
void Update ()
{
Set
}
#endif
void Set ()
{
if (terrain == null)
terrain = GetComponent<Terrain> ();
else if (terrain.basemapDistance != BasemapDistance)
terrain.basemapDistance = BasemapDistance;
}
}
Just want to add, that fixes the flickering in the Editor when the Terrain component writes the value, too. Using EditorApplication.update ins$$anonymous$$d of Component update ensures it's called after the InspectorGUI of the Terrain Component.
This is great but seems to have a very nasty side effect in that if you delete the GO that had this script on it, it continues to try and run causing increasing and infinite NREs in the editor.
Adding a function to remove the update on disable seems to fix it:
void OnDisable()
{
UnityEditor.EditorApplication.update -= Set;
}
This solution worked for me, with jwvanderbeck's modification below. Thanks guys!
Your answer
Follow this Question
Related Questions
Terrain distance rendering 1 Answer
How to stop the terrain from being blurry 0 Answers
HELP- my grass is all pixelated 1 Answer
terrain texture is blurry 8 Answers
Faded terrain texture edges 1 Answer