   Billboarding
  I tried and I tried. Googled every god damn billboarding tutorial, question and what not, but I just can't get it to work.I have the usual 2-triangles quad and I want it to face the camera.At first I tried the simplest thing - normalize each vertex (in the shader of course), rotate it by the inverse of the rotation 3x3 part of the modelview matrix, add it's length back, and continue transforming it usually.I have no idea why, but this doesn't work.From there I moved and looked at every old fixed-pipeline examples which I failed to translate to shaders, to some XNA tutorials that did things I didn't understand.I can't seem to find any reference that actually explains the math behind it in more then 2 sentences, and I have no idea what information the shader even needs.Currently I pass the vertices, projection and modelview matrices, and a "camera" which is just the current translation in the scene.I would really be glad if someone points me to somewhere that actually explains what needs to be done in words that I can understand, or explain it to me if you can.I am getting frustrated Thanks.   
    Here is example to render 1 billboard (in OpenGL).  float mv[16]; // holds a matrix computed from camera look  glGetFloatv(GL_MODELVIEW_MATRIX, mv); /* get view matrix */  float leftVector[3] = {mv[0],mv[4],mv[8]}; /* get rotated left (side) vector of camera */  float upVector[3] = {mv[1],mv[5], mv[9]}; /* get rotated up vector  of camera */ float position[3] = {/*put there a position of your billboard object*/};float quad_size = /* put there a size of your billboard object */;/* compute 3d vertex position for each point of quad */float LeftUP[3]; // it your "{-1,1} * quad_size + position" in 2D space// indexes {0,1,2} are {x,y,z}LeftUp[0] = (-leftVector[0] + upVector[0] ) * quad_size + position[0];LeftUp[1] = (-leftVector[1] + upVector[1] ) * quad_size + position[1];LeftUp[2] = (-leftVector[2] + upVector[2] ) * quad_size + position[2];float RightUp[3]; // it your "{1,1} * quad_size + position" in 2D spaceRightUp[0] = (leftVector[0] + upVector[0] ) * quad_size + position[0];RightUp[1] = (leftVector[1] + upVector[1] ) * quad_size + position[1];RightUp[2] = (leftVector[2] + upVector[2] ) * quad_size + position[2];float RightDown[3]; // it your "{1,-1} * quad_size + position" in 2D spaceRightDown[0] = (leftVector[0] - upVector[0] ) * quad_size + position[0];RightDown[1] = (leftVector[1] - upVector[1] ) * quad_size + position[1];RightDown[2] = (leftVector[2] - upVector[2] ) * quad_size + position[2];float LeftDown[3]; // it your "{-1,-1} * quad_size + position" in 2D spaceLeftDown[0] = (-leftVector[0] - upVector[0] ) * quad_size + position[0];LeftDown[1] = (-leftVector[1] - upVector[1] ) * quad_size + position[1];LeftDown[2] = (-leftVector[2] - upVector[2] ) * quad_size + position[2];glBegin(GL_TRIANGLES); // just a sample. I want to explain how to draw billboard object. So, I do not use VBO, VAO etc.glVertex3fv(LeftDown); // first triangleglVertex3fv(RightDown);glVertex3fv(LeftUp);glVertex3fv(LeftUp); // second triangleglVertex3fv(RightDown);glVertex3fv(RightUp);glEnd(); // that's all. Of course, the code can be smaller if to use vector classes with overloaded operators.I'm glad to help you. Ask if you have a questions.- FXACE.   