PDA

View Full Version : Fastest way to billboard



SquidMan
12-08-2001, 08:49 PM
What is the fastest way to billboard 500+ objects?

Nutty
12-09-2001, 05:06 AM
Depends what hardware you're running on.

For geforce 3 w/ average cpu I would do billboarding in a vertex program.

For a cpu like a 2ghz P4, build the billboard vertices using SSE in assembler..

Just make sure you dont do any glGet*() instructions, cos they are slow.. and dont do a "push rotate render pop" per billboard either.

Store a local copy of the modelview matrix, and build the vertices using highly optimized assembler if you have a fast cpu, or do it in a vertex program (only if it's in hardware ala geforce 3..etc.)

Building the vertices is easy. Given the centre point of your billboard "p", extract the "right" and "up" vectors out of the modelview matrix, and build the 4 corners of the quad like this.

p1 = p - right + up
p2 = p + right + up
p3 = p + right - up
p4 = p - right - up

Build a continuous array of billboards, and dispatch them to the video card all in 1 go.

Use alpha test, if the hardware has it for free, to save bandwidth around the transparent parts of each billboard.

Nutty

dorbie
12-09-2001, 06:25 AM
Look here for some tips:
http://www.dorbie.com/billboard.html