Particle trails with OpenGL
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.
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:
with:Code:
float factor = dx*dx+dy*dy;
float normal = 1.0f/sqrt(factor);
You'll need to #include <ppc_intrinsics.h> and compile with -force_cpusubtype_ALL to get it to work.Code:
float factor = dx*dx+dy*dy;
float normal = __frsqrte(factor);
normal *= (1.5f - (0.5f*factor * normal * normal));
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);---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
We're creating geometry, not lighting normals.
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
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
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
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Particle trails | LongJumper | 6 | 3,049 |
Jun 29, 2005 12:42 AM Last Post: LongJumper |
|

