38(58) Information Coding / Computer Graphics, ISY, LiTH Billboards A texture mapped polygon, which always faces the viewer 38(58)
Billboards 2D images placed on surfaces that are always facing the camera Sprites in older action games Advanced version: impostors Often used for complex objects even today Example: forests 39(58)39(58)
Classic example: Doom Big billboards. No 3D models. 40(58)40(58)
Classic example: Dark Forces Big billboards. Some 3D models. 41(58)41(58)
Problem with too few views. 42(58)42(58)
Implementing billboards Billboards generally need transparency => Special care is needed to avoid problems with Z-buffering 43(58)43(58)
Transparency 1) Sort by distance (Painter's algorithm) Perfect results Supports semi-transparency Required sorting and a separate stage 2) Discard fragments No semi-transparency Some artifacts at edges Very easy 44(58)44(58)
discard; as cheap solution to transparency #version 150 out vec4 outcolor; in vec2 texcoord; uniform sampler2d tex; void main(void) { vec4 t = texture(tex, texcoord); if (t.a < 0.01) discard; else outcolor = t; } 45(58)45(58)
Implementing billboards Texture files must support transparency File formats: TGA PNG TGA: simple format, good for demos Libraries for PNG: libpng PNGlite by Daniel Karling 46(58)46(58)
Implementing billboards Variants: World oriented billboard Viewpoint oriented billboard (face the camera in full 3D) Axial (viewpoint) billboard View plane oriented billboard View plane oriented axial billboard 47(58)47(58)
View plane oriented billboard Easy Zero out rotation Good - no overlaps Viewpoint oriented View plane oriented 48(58)48(58)
Axial billboard Rotate around Y Non-axial Axial Suitable for trees etc 49(58)49(58)
Full 3D viewpoint oriented billboard Change of basis solution Z vector from viewpoint, pick an up vector (usually Y axis), form basis with cross products 50(58)50(58)
World oriented billboard No camera dependent rotation Example: Tomb Raider 2 Terracotta warriors (Temple of Xian) 51(58)51(58)
A grid of billboards Viewpoint oriented View plane oriented Non-axial Construct basis Construct basis based on view plane Axial Clear rotations Construct axial rotation World oriented billboard not in grid 52(58)52(58)
Billboard variants 1) Always facing the camera. One triangle or quad is enough 2) A few polygons. Good for world oriented billboards. 3) Multiple billboards. Simplify complex objects om moderate distance. 53(58)53(58)
Temple of Xian Statues behind first row are billboards 54(58)54(58)
Billboard variants The objects on the plate are billboards - some 2-poly 55(58)55(58)
Application: Particle systems Explosions, rain, fountains, smoke... Excellent billboarding application Many small objects - good opportunities to cheat with transparency problems More about this in the Animation part 56(58)56(58)
Impostors Live billboards Render to texture, update sometimes Render as other billboards Decide when to update 57(58)57(58)
Large worlds, conclusions HIgh-level VSD to limit processing to visible parts - start with frustum culling Level-of-detail to reduce unneccessary processing of detailed models Use billboards for extreme simplification on large distance, particle effects etc If we can t see the difference, use the cheaper solution 58(58)58(58)