- Home /
Optimizing framerate on lots of billboards
I have a scene with lots of billboards (10.000+). There is occlusion- and per-layer culling going on. When most of the billboards are in view frustum the frame rate is about 30FPS. I am wondering why the frame rate remains low when the cam isn´t moving. What would be an appropiate method to let the scripts fall asleep if the cam is not turned?
Currently I am using LateUpdate() and if (renderer.isVisible). Here the code:
using UnityEngine; using System.Collections;
public class CameraFacingBillboard_up : MonoBehaviour { public Camera m_Camera;
void LateUpdate()
{
if (renderer.isVisible)
transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.back,
m_Camera.transform.rotation * Vector3.up);
}
}
Any other hints? Thx heaps
Answer by Aleron · Dec 21, 2011 at 05:01 PM
How many draw calls are being made when you are seeing the 30FPS? (You can see them by turning on the Stats in the Game window of the editor)
My guess is that your low frame rate isn't related to script processing but rather GUI processing. One way to improve that performance is to reduce the number of draw calls being made by combining meshes and combining materials. Using static batching may be an option if your billboards are repeating a lot of the same static textures.
I'm far from an expert on this aspect of Unity, but this will hopefully help as a starting point. :)
You wouldn't be able to use static batching for billboards; the point of static batching is that the objects don't move.
Thanks Aleron for the reply. Of course I have a huge amount of Draw Calls (5000+ @ 30FPS) but the profiler points out an issue with the scripts... @Eric, thats what I have been wondering about as well. I will comment your answer beneath.
Answer by Eric5h5 · Dec 21, 2011 at 06:18 PM
Having 10K LateUpdate calls on 10K objects is a massive amount of overhead. You should use something more specific to this sort of thing like a particle system.
$$anonymous$$mh... A particle system? $$anonymous$$y billboards are widely spread over a big area. They get culled by frustum and occlusion but there are still a lot visible at any point. I thought about to static batch them in distance and when you move closer they get individual. Could that work?
No, as I mentioned in the other answer, static batching only works on objects that don't move (rotating to face the camera is movement). What you're talking about sounds similar to the tree system, which isn't done with individual objects. It's not a particle system, but it's somewhat similar in concept.
I highly recomend Sprite$$anonymous$$anager or similar which combines billboards/sprites with their textures (merged into one texture atlas) to one object. Thx for the pointers! reg
@Jango do you know of any examples that demonstrate how to achieve this? Cheers for the tips!
Your answer
Follow this Question
Related Questions
How to render severals cameras at differents Frame Rate ? 2 Answers
Android lag 1 Answer
Andriod (Oculus Quest 2 app) locked at 30 fps 1 Answer
Messenger.Broadcast VS GetComponent 1 Answer
Sudden Framerate drops at random times?? 2 Answers