I’m trying to make a terrain, which is 3000x2000. I have trees, where I want to see them from one end of the map to the other. I put in some code to make the trees visible at a further distance:
However even with this code the trees disappear after about 1500. I have confirmed using breakpoints, that it’s calling the code. I’m using a standard perspective camera:
I have a zoom function, which brings the FoV to 5, and that shows the trees correctly. However when the player zooms back out, the trees pop off view completely, even though they’re only about 1500 away. I’ve set the tree’s view distance in Terrain Settings, at the max distance (which is 2000). I’m also using the Unity Environment Assets bundle that comes with Unity. The only tree I have in there that I want to see is the broadleaf mobile version.
Can anyone explain to me what’s going on? I have set my Build for Android Development.
For reference, I don’t even mind manually checking the device’s rendering/processing speed while playing the game, and editing specific terrain settings for optimisation later. I just want to be able to see trees at a longer distance. Even in the editor view itself (not in play mode, in editor mode), they disappear from view after about 1500.
I’m almost at the point of adding the tree assets outside of the terrain, and programming in a check for distance and switching to their billboard counterparts by my own checks, and handling occlusion myself… But I really would like it if the terrain handled that itself for me…
For LOD trees like SpeedTree, the view distance is only dependent on LOD settings (the LODGroup settings and LOD bias in the quality settings). Usually for a LODGroup it disappears when the size on the screen is less than 1%. You can drag the slider to make it even smaller than that.
I had that problem with one particular Speedtree. Then I noticed the billboard was not included in the LOD group for some reason. I replaced it and my trees are back at a distance. Make sure you check the LOD groups if you have another problem.
instead of the code, or maybe even keeping it, a fix may have to be done to the camera. In the camera, go to the component ‘camera’ and then clipping planes. You may have to adjust the ‘far’ one, making it larger, or in some cases smaller