|
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.
(comments are locked)
|
|
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. Yes - that should definitely work. Somehow though, my innate sense of elegance just won't let me take that route though :)
Jan 17 '10 at 05:14 PM
Aubrey Falconer
(comments are locked)
|
|
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...
If it would work, this would be the most elegant solution of all!
(comments are locked)
|
|
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. The different cameras already have different culling properties - but I am loading worlds from AssetBundles and I can't rely on trees being on correct layers in each world ahead of time. If I could figure out a way to assign the trees to layers at runtime, that would be perfect.
Dec 17 '09 at 06:38 PM
Aubrey Falconer
(comments are locked)
|
