Hi,
I want to improve the performance of a scene with many waterfalls. The waterfalls are particle effects. I’m keen to have them occluded by the terrain, but attempting to bake just the terrain and the waterfalls crashed with an our of memory exception. I have 16gb of ram, 64bit windows. I have attempted a very large cell size and a small cell size with identical result. The crash occurs instantly. I have the same behavior if i attempt to bake a smaller scene with a 1km X 1km terrain. Is umbra / occlusion culling unusable for outdoor / terrain based scenes? My alternative i just a LOD style technique and pausing the effect when at a certain distance from the waterfall. Is there better alternatives that this?
Cheers,
Loki
A few more questions related to this. What are people doing to make large outdoor scenes work? Is there a way to occlusion cull small areas? i.e manually place portals for occlusion culling and bake very simple rules. Is there a way to make the occlusion system work on larger size worlds?
Can you use loadleveladditive to load baked sections of occluded levels?
I’m contemplating using an Instantiate / Destroy based LODs to dynamically load the world sections. How do people work around the streaming limitations in Unity?
Not sure about your crash (I haven’t experienced any). Can you bake occlusion for particle emitters? I would assume so but you should check into that.
A few of things I’ve come up with for open worlds:
- Put large, cheap objects (like boulders) in the center of complex areas. Use those as occluders. Cleverly placed, they’ll (substantially) lower your scene complexity.
- Separate complex areas far enough and turn up fog so you can turn off details. I’m currently working on a set of islands, so it’s pretty easy to do that, but you could think of complex areas as logical islands with sparse areas separating them. That may or may not work for you.
- If you have large overlapping areas with a lot of alpha blending / testing, you might want to move to modeled opaque geometry if you can. I’ve been modelling leaves and grass and using opaque shaders for some decent performance gains (platform dependent, of course).
I’ve also moved away from Unity Terrain in favor of hand modeled meshes. I don’t use LODing on the terrain so I have to be clever about occlusion culling but I haven’t seen it as a performance hit. I hesitate to post something that sounds like “my game looks like shit therefore Unity sucks” but I do think the detail and tree management in Unity is a bit lacking. It’s more work to do it all “by hand” but I get better results that way.
Thanks for the hints. Are you baking with Windows? I’ve heard some talk that it might be Windows specific.
It’s currently a large, open world done as Islands with plenty of large boulders occluding things. Alas no occlusion yet.
How did you cope with trees on the mesh terrain? I tried using meshes instead of the unity tree system and 20k trees is terrible to deal with in the editor and is slow in game, where as 400k trees is fine with the terrain system.
No, on a Mac.
I simply don’t use that many trees. In the case of large groups of small trees (like bamboo) I combine models (in Maya) into 8x8 or 4x4 meter blocks. I do the same with grasses. That seems to be a good tradeoff for rendering performance / culling / removing batching overhead. For single trees I use relatively small numbers of large trees (scaling a tree up to take up more space is almost free). Also, like stated above, I sometimes switch to opaque geometry for the leaves.
Of course occlusion culling doesn’t need to be your primary way of dealing with complexity. You can setup per-layer culling distances in your camera and use LOD groups. I use all of the above.
Having said that, I have been working on a billboarding system for my own trees using render textures. My original was all done on the fly (mostly for testing) but I think if I decide to use it it’ll generate the billboards in the editor, probably capturing 4 or 8 angles of the mesh and switching or blending between them. It’s not a trivial thing to implement so I’ll avoid it if I can. It’s simple enough to get the extents of a mesh at an arbitrary angle and take a snapshot of it but you have to be aware of things like the alpha channel in shaders (most don’t write to it) and perfectly matching apparent size, lighting, fog, making transitions seamless, etc.