In the case of not really needing a lower LOD, in other words a single mesh, but wanting to cull the object after a certain distance, say a small rock for example, what is the best approach for object based culling?
I was thinking of just putting an LOD group onto the prefab and setting the cull distance with that.
Maybe I should make several layers like cull_small, cull_medium, etc and assign layerCullDistances to them instead?
Does anyone know of a difference in performance between the two? For example if used on 50,000 objects in the scene. My first blunder at manual culling long ago with per object distance checks did not go well as you can imagine. I’m interested in keeping performance choices like these as best as I can because there are literally
tens of thousands of object in the scene.
I’m now using a trigger sphere to enable and disable things that get close enough to the player, such as status bars/health bars, as well as LOD groups to cull rocks and things based on distance even if they only have one LOD. It’s working well.
I know its an old post, but I was wondering about this as well. I would assume managing cull distance through layers would be more efficient, rather than assigning a LODGroup to the object. The ladder however would allow a dithered transition on culling, which would be really nice.
Using a culling layer is much easier to setup as each object you need to be culled just needs to be set to that layer.
It should also be better at performance (I haven’t tested this though) as each camera is already using this.
The downside I’ve noticed is that flickering can occur if the camera is near the threshold of showing or not showing the gameobject.
LOD groups don’t have the flickering issue, but take more time to setup and most likely have more of and impact to performance, although I’m sure of very minimal.
Using fade transitions on LODs I know is a bit performance heavy. I am still using LOD groups primarily because I don’t want to spend layers for rendering, I use them for physics and interactions. I suppose separating the mesh and collision of things to create a near, medium, and far layer for rendering would be pretty nice as you could then let the player adjust those settings to their liking in runtime. One of the biggest problems with the LOD groups is that they’re bound to Unity’s universal LOD setting, which is basically a single multiplier. If you change that, everything changes, which makes is very hard to let players turn up or down the render distance of things based on their hardware.
More performance intensive than that for me has turned out to be the enable/disabling of objects. Enabling/disabling components is very fast, but enabling/disabling gameobjects is very slow when you’re doing thousands of things, pools or not. I’m looking to split my loading into chunks and manage object/component enabling/disabling on a per frame basis. After I do 900,000 other things.
Yea disabling/enabling whole gameobjects can slow. Especially if there are a lot of components with OnE able and OnDisable code attached to them.
Enabling/disabling renderer components are extremely quick… I’m currently doing that with hundreds of meshes in a single frame with no performance impact.
About TEST - 1200 objects
First test i leaved Low poly and High poly at scene ,not disabling lod1 (8 verts) renderer enabled - result 230fps / max 1400 batches
Second test with script enabled - result 300fps / max 900 batches