Hello.
I’ve implemented a camera engine that use gluLookAt (Free camera).
My camera can provide these informations :
Camera.Pos (Space coord x,y,z)
Camera.LookAt (Direciton Vector)
Camera.UpVector (UP vector )
Camera.RightVector (RIGHT vector )
And I set my camera like this :
gluLookAt( Camera.Pos.x,
Camera.Pos.y,
Camera.Pos.z,
Camera.Pos.x + Camera.LookAt.x,
Camera.Pos.y + Camera.LooAt.y,
Camera.Pos.z + Camera.LooAt.z,
Camera.UpVector.x,
Camera.UpVector.y,
Camera.UpVector.z
);
Now I’m able to realize a cylindrical billboard (quads building)
but I don’t understand what to do to realize a spherical billboarding.
The billboard should be spherical cause the camera will move around a
particles foutain and as it’s free(camera) then it can pass above the fountain.
To draw the quads(Particles), I proceed like that :
RightVector = Camera.GetRightVector; RightVector.x = RightVector.x * Quad_Half_Width; RightVector.y = RightVector.y * Quad_Half_Width; RightVector.z = RightVector.z * Quad_Half_Width; UpVector = Camera.GetUpVector; UpVector.x = UpVector.x * Quad_Half_Height; UpVector.y = UpVector.y * Quad_Half_Height; UpVector.z = UpVector.z * Quad_Half_Height; glBegin( GL_QUADS ); glVertex3f( ObjectPosX - (RightVector.x + UpVector.x), ObjectPosY - (RightVector.y + UpVector.y), ObjectPosZ - (RightVector.z + UpVector.z) ); glVertex3f( ObjectPosX + (RightVector.x - UpVector.x), ObjectPosY + (RightVector.y - UpVector.y), ObjectPosZ + (RightVector.z - UpVector.z) ); glVertex3f( ObjectPosX + (RightVector.x + UpVector.x), ObjectPosY + (RightVector.y + UpVector.y), ObjectPosZ + (RightVector.z + UpVector.z) ); glVertex3f( ObjectPosX - (RightVector.x - UpVector.x), ObjectPosY - (RightVector.y - UpVector.y), ObjectPosZ - (RightVector.z - UpVector.z)); glEnd();
ObjectPos is where the Billboard quads(Particles) will be drawn.
When the camera goes forward, backward, rotate left/right or strafing right/left,
the quads are well facing the camera but when I raise the camera and I look
down (CamLook), the Quads do not facing the camera.
Consequently, they(quads) should undergo a rotation around the RIGHT vector but ???
PS :Perhaps the error cames from me cause when I raise the eye(lookAt) of the camera
I modify the LookAt vector but I don’t modify the UP vector.
CamLook.y = Sin(Eye_Elevation_Degres);
I think the UP vector have to be modify cause pretend I raise my eye to the sky,
the UP vector of my head(Camera) will move backwards...
But, how modify it and, could the error come from this ?
I thank you in advance.
Martin
PS :Excuse these many confusions and this long annoying question
but I’m tired to seek informations on Billboarding (Without use the ModelView matrix).