Particle trails with OpenGL

Member
Posts: 156
Joined: 2002.11
Post: #16
Quote:Originally posted by NCarter
If you point them directly at the camera they'll look distorted as they approach the edge of the screen.

In the proper sense, billboards are parallel to the screen. But in the context of contrails, we started using the term "billboarding" loosely just to help illustrate the case, and you've just made me regret doing so.

No hard feelings though.
Member
Posts: 469
Joined: 2002.10
Post: #17
Quote:Originally posted by arekkusu
mars: Once you start coding this, if you follow the outline BobimusPrime gave (which I think is an accurate way to do what you want in 2D), you will find that most of your CPU time is going into sqrt();

To get around that, approximate the sqrt, which can be done with the PPC's frsqrte instruction and the Newton-Rhapson method. Replace:
Code:
```float factor = dx*dx+dy*dy; float normal = 1.0f/sqrt(factor);```
with:
Code:
```float factor = dx*dx+dy*dy; float normal = __frsqrte(factor);                 normal *= (1.5f - (0.5f*factor * normal * normal));```
You'll need to #include <ppc_intrinsics.h> and compile with -force_cpusubtype_ALL to get it to work.

This premature optimization tip brought to you by many hours of creating basic GL primitives that don't suck.

um... why not
Code:
`glEnable(GL_NORMALIZE);`
? Unless you're using these normals for something other than passing to GL...

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Sage
Posts: 1,234
Joined: 2002.10
Post: #18
We're creating geometry, not lighting normals.
BobimusPrime
Unregistered

Post: #19
I put together a tutorial type thing for if the path is in 3D. Something I didn't mention in the tutorial is that back face culling should be turned off. If the path switches directions you will end up seeing the back of some of the quads so having it turned off will solve this problem.

http://www.bobbosoft.com/3dpath.html

Fenris:
I could turn these into a tutorial for idevgames if it seems like it would be useful. I probably won't want to leave the tutorials on my site in the form they are in for too long as i sort of just tossed them in there .

Hope this helps!

Robert
deekpyro
Unregistered

Post: #20
Quote:Originally posted by BobimusPrime
I put together a tutorial type thing for if the path is in 3D. Something I didn't mention in the tutorial is that back face culling should be turned off. If the path switches directions you will end up seeing the back of some of the quads so having it turned off will solve this problem.

http://www.bobbosoft.com/3dpath.html

Fenris:
I could turn these into a tutorial for idevgames if it seems like it would be useful. I probably won't want to leave the tutorials on my site in the form they are in for too long as i sort of just tossed them in there .

Hope this helps!

Robert

Thanks so much man, this weekend I'll really dig into it and see what I can do. Much appreciation for any help!

Derek