Advertisement

Single point billboarding

Started by December 18, 2003 02:04 PM
2 comments, last by moogle33 21 years, 2 months ago
Does anybody kow how to make a billboard out of one 3D point ? I want to apply a texture that is always facing the camera but I only have one point in 3D space how can I do this? PS I have loads of points so id like to use an opengl function to do it if posssible cus doing all that matrix maths would relly slow my app down
I believe what you are looking for is a point sprite. It''s basically a texture mapped point.
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
Advertisement
what you need to do is get 2 vectors (per frame) wich is quite inexpensive) from your view matrix

CVECTOR billboardRight=CVECTOR(viewMatrix.entries[0],viewMatrix.entries[4],viewMatrix.entries[8]);
CVECTOR billboardUp=CVECTOR(viewMatrix.entries[1], viewMatrix.entries[5],viewMatrix.entries[9]);

and based on those vectors construct your quad, triangle ,triangle strip or whatever polygon you wish to apply texture to , something like this(for a quad):

m_pVertices[0]=particles.position-billboardRight-billboardUp;
m_pVertices[1]=particles.position+billboardRight-billboardUp;<br>m_pVertices[2]=particles.position+billboardRight+billboardUp;<br>m_pVertices[3]=particles.position-billboardRight+billboardUp;<br><br>this method has an advantage over point sprites , it allows scaling. </i>
---sorry for not using proper english , I'm from latin roots
If you''re familiar with OpenGL extensions, you should definately take a look at GL_NV_point_sprite and GL_ARB_point_sprite extensions. They have very few limitations and are much more optimized that any matrix-based quad rendering.

This topic is closed to new replies.

Advertisement