Performance issues - polys and billboards

Started by AW999, March 03, 2010, 11:20:08 PM

Previous topic - Next topic

AW999

I assume that the frame rate will be far higher if the terrain is formed from 'billboarded' objects rather than quads (two polys) ?  I.e., let's say you start with a typical terrain mesh formed from quads which have a flat 'grass' texture, then replace each of those with a billboarded 3D object representing a tuft of grass with billboarding set for all but the closest distance (or even when right in front of the viewer). I would think that since a 'billboard' is just a bitmap image, it should be faster to render than a polygon, hence a landscape made up mostly (or entirely) of billboard images should have a higher frame rate than a polygon mesh? Or am I missing something?

EgonOlsen

A billboard IS an Object3D. It's just rotated in a way that it always faces towards the camera. So in your scenario, i don't think that this will do any good unless i got you wrong somehow.

AW999

Quote from: EgonOlsen on March 03, 2010, 11:25:31 PM
A billboard IS an Object3D. It's just rotated in a way that it always faces towards the camera. So in your scenario, i don't think that this will do any good unless i got you wrong somehow.

  I thought the whole point (the only point) of billboards was to improve rendering speed by displaying a static bitmap image of the object beyond a defined distance?  Otherwise, what's the point? 
Are there any plans to implement bitmapped billboards? 

paulscode

Quote from: AW999 on March 03, 2010, 11:44:14 PMI thought the whole point (the only point) of billboards was to improve rendering speed by displaying a static bitmap image of the object beyond a defined distance?  Otherwise, what's the point?
The point of billboards is to simulate a volume of some kind with only two polygons, vs the multiple polygons that would be required to do the same without billboarding.  Billboards are useful for all sorts of things, including plants and trees, spheres, smoke, explosions, glowing effects, etc.  I use them all the time myself.

AW999

Quote from: paulscode on March 04, 2010, 12:41:39 AM
Quote from: AW999 on March 03, 2010, 11:44:14 PMI thought the whole point (the only point) of billboards was to improve rendering speed by displaying a static bitmap image of the object beyond a defined distance?  Otherwise, what's the point?
The point of billboards is to simulate a volume of some kind with only two polygons, vs the multiple polygons that would be required to do the same without billboarding.  Billboards are useful for all sorts of things, including plants and trees, spheres, smoke, explosions, glowing effects, etc.  I use them all the time myself.

  But Egon Olsen just said that a billboarded object is just a normal object except "It's just rotated in a way that it always faces towards the camera."  Based on that, it would have the same number of polys as it usually would.

paulscode

Quote from: AW999 on March 04, 2010, 12:58:16 AMBased on that, it would have the same number of polys as it usually would.
How do you figure?  Just because you rotate a 2-poly Object3D so it always faces the camera, it still only has 2 polys.  Use the appropriate texture, and Voila - you have your simulated volume.

AW999

Quote from: paulscode on March 04, 2010, 01:59:25 AM
Quote from: AW999 on March 04, 2010, 12:58:16 AMBased on that, it would have the same number of polys as it usually would.
How do you figure?  Just because you rotate a 2-poly Object3D so it always faces the camera, it still only has 2 polys.  Use the appropriate texture, and Voila - you have your simulated volume.

  Ok, I looked at the comments in this thread again and it turns out I misinterpreted a few things.

EgonOlsen

What you want are 2D imposters, not billboards. You can create imposters by using billboards, but that would mean that you have some more detailed geometry than the imposters/billboards for the near distance available, i.e. a real grass model. If your grass is always flat and billboarded, there's no point in using imposters.

AW999

Is there are a convenient bit of sample code for using billboarding?  I haven't been able to find much for some reason.

EgonOlsen

There's not much to do:


yourObject.setBillboarding(Object3D.BILLBOARDING_ENABLED);


AW999

Quote from: EgonOlsen on March 04, 2010, 09:34:27 PM
There's not much to do:


yourObject.setBillboarding(Object3D.BILLBOARDING_ENABLED);



  Is there a distance setting (the distance at which the object is billboarded), or do you have to run a loop thru all the objects for each frame and set each one based on its current distance from the camera?

EgonOlsen

No, there is no distance setting. What you do with billboards is totally up to you.

paulscode

Billboards work like any other Object3D.  Place them somewhere in 3D space and they will be drawn the size/order that they should be.

Quote from: AW999 on March 04, 2010, 09:18:56 PMIs there are a convenient bit of sample code for using billboarding?  I haven't been able to find much for some reason.

This may not be the best example in the world, but if you are interested in seeing one of the many countless things that billboards can be used for, check out my firefly demo applet posted in this thread.  A billboard is used to create a glowing effect in that example.  I posted a link to the source code there as well.