0
\$\begingroup\$

I was reading the Unity manual on trees and one of the claims made is as follows:

Unity uses optimisations (eg, billboarding for distant trees) to maintain good rendering performance...

I was planning on doing my own billboarding for a game I'm building anyway, so knowing that I'm going to gain a performance advantage is good to know. However, when I tried looking a little deeper at how billboarding is done in Unity, I found these sources:

http://wiki.unity3d.com/index.php?title=CameraFacingBillboard http://answers.unity3d.com/questions/20697/how-to-create-billboarding-planes.html http://answers.unity3d.com/questions/52656/how-i-can-create-an-sprite-that-always-look-at-the.html

Which all show that the way to do billboarding is to do a transform on the object each frame to make it face the camera. (I can't find much about billboarding in the official Unity documentation).

How does billboarding affect performance? Why would there be a performance boost if you have to transform "dense forests with thousands of trees" before each frame? Does unity have a native billboarding shader built in? If not, wouldn't billboarded sprites require, at the very least, the same amount of rendering power as other objects being drawn in a 3D scene?

\$\endgroup\$
1
  • \$\begingroup\$ The advantage is that you don't render the tree, just a picture of the tree \$\endgroup\$
    – user253751
    May 5 at 19:46

2 Answers 2

2
\$\begingroup\$

In the more general sense, "Billboarding" means that an object in a 3d-scene (usually but not always a 2d-sprite) is always rotated to face the camera. A common use-case are spatial UI elements in a 3d scene. Take, for example, a real-time strategy game with a 3d engine where every unit has a health-bar below it. That health-bar would use billboarding to always be fully readable for the player no matter how they rotate the camera.

But in the specific context of performance optimization, Billboarding means that complex 3d models are rendered to 2d sprites and those sprites are then used in a billboarding manner. This means the object only needs to be rendered in full detail once and can then be inserted multiple times into the 3d scene as a simple textured square. This greatly improves rendering speed of a large number of identical, complex 3d objects (a forest of trees is the most obvious example). Such billboards are also called "imposters".

However, it has a price: This shortcut becomes very visible on short distances where it becomes obvious that shadows and clipping are way off. That's why it is usually only used for very far-away objects while closer instances of the same object are properly rendered in 3d.

Also, when you only use one sprite for each object, it might look a bit strange when the object is seen from a different angle than the billboard-screenshot was taken, for example when you are flying far above the forest and you still see all the trees from the side. That's why imposter systems often take screenshots from several directions of a 3d model and draw the one closest to the current view-angle when rendering.

Unity does have an imposter system built in, but unfortunately only allows you to use it for the Tree component in conjunction with the Terrain component. When you don't use the Unity terrain and want to use an imposter for something you can not generate through the SpeedTree system, then you will have to either use a 3d party asset or program it on your own.

\$\endgroup\$
1
\$\begingroup\$

Billboarding draws 2d sprites instead of 3d ones, when they are far away. This wouldn't look good, if you don't rotate them, so they always face the camera. This technique can make the game run a lot faster, because instead of drawing 1000 or more polygons for a single tree, you only draw a 2d rectangle with the image of the original tree.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .