Author Topic: Performance issues - polys and billboards  (Read 4068 times)

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Performance issues - polys and billboards
« on: March 03, 2010, 11:20:08 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Performance issues - polys and billboards
« Reply #1 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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Performance issues - polys and billboards
« Reply #2 on: March 03, 2010, 11:44:14 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? 

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: Performance issues - polys and billboards
« Reply #3 on: March 04, 2010, 12:41:39 am »
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?
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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Performance issues - polys and billboards
« Reply #4 on: March 04, 2010, 12:58:16 am »
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?
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.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: Performance issues - polys and billboards
« Reply #5 on: March 04, 2010, 01:59:25 am »
Based 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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Performance issues - polys and billboards
« Reply #6 on: March 04, 2010, 02:17:44 am »
Based 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.
 

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Performance issues - polys and billboards
« Reply #7 on: March 04, 2010, 07:41:03 am »
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.

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Performance issues - polys and billboards
« Reply #8 on: March 04, 2010, 09:18:56 pm »
Is there are a convenient bit of sample code for using billboarding?  I haven't been able to find much for some reason.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Performance issues - polys and billboards
« Reply #9 on: March 04, 2010, 09:34:27 pm »
There's not much to do:

Code: [Select]
yourObject.setBillboarding(Object3D.BILLBOARDING_ENABLED);

Offline AW999

  • int
  • **
  • Posts: 57
    • View Profile
Re: Performance issues - polys and billboards
« Reply #10 on: March 04, 2010, 09:39:34 pm »
There's not much to do:

Code: [Select]
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Performance issues - polys and billboards
« Reply #11 on: March 04, 2010, 10:24:12 pm »
No, there is no distance setting. What you do with billboards is totally up to you.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: Performance issues - polys and billboards
« Reply #12 on: March 04, 2010, 10:38:52 pm »
Billboards work like any other Object3D.  Place them somewhere in 3D space and they will be drawn the size/order that they should be.

Is 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.