MiniMap Camera Terrain Vegitation

I have a MiniMap camera floating above my scene, and I want it to render my terrains without rendering the vegetation on them.

I have a script attached to the camera, the relevant parts of which are included below.

The script sets the terrain's terrainTreeDistance and terrainDetailDistance to 0 before the camera renders, and after the camera renders, it resets the terrain to it's previous state.

Interestingly enough, the minimap camera renders trees on the terrain even with this script present. I know the script is properly changing the terrain vars, because if I remove the OnPostRender() section of the script, the trees disappear.

It looks like the terrain object defers the application of my settings 'till after the camera has rendered, by which time it is too late to do any good. Could this be possible, and if not - what else could I be doing wrong?

Ryan Scott suggested that I use shader replacement to hide the trees - and I may end up needing to - but I would much rather save the terrain object all the work of feeding the trees to the graphics pipeline to begin with.

function OnPreRender () {
    revertFogState = RenderSettings.fog;
    RenderSettings.fog = false;

    if(World.terrains) {
    	if(World.terrains[0].lighting == TerrainLighting.Pixel) terrainLighting = true;
    	else terrainLighting = false;
    	terrainLOD = World.terrains[0].heightmapMaximumLOD;
    	terrainTreeDistance = World.terrains[0].treeDistance;
    	terrainDetailDistance = World.terrains[0].detailObjectDistance;
    	for (var trn : Terrain in World.terrains) {
    		if(Game.Settings.renderLevel > 4) trn.heightmapMaximumLOD = 3;
    		else if(Game.Settings.renderLevel > 3) trn.heightmapMaximumLOD = 4;
    		else trn.heightmapMaximumLOD = 5;
    		trn.lighting = TerrainLighting.Lightmap;
    		trn.treeDistance = 0;
    		trn.detailObjectDistance = 0;
    	}
    }
}

function OnPostRender () {
    RenderSettings.fog = revertFogState;

    if(World.terrains) for (var trn : Terrain in World.terrains) {
    	trn.lighting = (terrainLighting ? TerrainLighting.Pixel : TerrainLighting.Lightmap);
    	trn.treeDistance = terrainTreeDistance;
    	trn.detailObjectDistance = terrainDetailDistance;
    	trn.heightmapMaximumLOD = terrainLOD;
    }
}

How about making duplicate terrains on a different layer, which are the same as the regular terrains, but without vegetation? If you remove the terrain collider so there's no additional performance hit, I think the only drawback would be taking up extra memory.

Note: I attempted to post this as a comment on my original post, but the answers software wouldn't let me because it said my post was locked or deleted. This site sure is full of bugs!

I just attempted altering the tree's layers at runtime, but although Unity gives no errors - the trees still render on the terrain layer...

for(var tP : TreePrototype in trnDat.treePrototypes) tP.prefab.layer = 11;

If it would work, this would be the most elegant solution of all!

Can the different cameras have different culling properties with respect to layers? Then you could assign the trees to a vegetation layer permanently, and not worry about changing layer at runtime.

I realize this post is more than 9 years old, but in case anyone ends up here by googling the same problem (like I did), I found that you can disable tree rendering for a given camera by setting the terrain’s drawTreesAndFoliage property to false in OnPreCull, then turning it on again in OnPostRender. This works great for me in Unity 2018.3. Note that it does not work when doing the same in OnPreRender!