pouët.net

camera-facing 2d stripes

category: general [glöplog]
 
Hey,

I have an array of points (say, a b-spline) in 3d, and I'm trying to get this to always render facing camera.

What I'm doing now is I'm first inverting the modelview matrix. Then the OpenGL docs says I should multiply that with the vector (0,0,0,1) which doesn't make sense as the fourth row is irrelevant anyway for rotation?

I've tried with various values for this vector, (0,0,1) would make sense in the next step where I will cross-product the camera position with the delta vector from the spline to get the direction vector of the face.

Any thoughts?
added on the 2010-03-01 23:21:51 by jaw jaw
(It isn't working properly, when the spline ends up in corners it still gets flat)
added on the 2010-03-01 23:22:43 by jaw jaw
google up on "camera-facing quads" or "billboarding" -- that should tell you all you need.
added on the 2010-03-01 23:24:59 by superplek superplek
SPEED OMA: that's not very helpful.

jaw: just billabong the billboard bungle biggle...that should fix it.
added on the 2010-03-02 01:06:24 by button button
billboarding helps everyone.
Quote:
http://www.arieladvertising.com/images/outdoor-billboard_dxi6.jpg


(Oh, okay then)

added on the 2010-03-02 10:03:09 by gloom gloom
Fail.
added on the 2010-03-02 10:03:21 by gloom gloom
i never said it was very helpful :) anyway, you just gotta make sure that your camera translation or whatever it is you do prior to projection does not rotate the 4 points of the camera-facing quad (if thats the case) away from the camera in any sort of way. you just need it to displace in terms of 2d pos (usually center of the quad) and depth.

i could send you a load of sourcecode doing exactly what you wanna see but i think you're better off finding out yourself.
added on the 2010-03-03 03:49:30 by superplek superplek
a quick method, maybe not the best:
do that for each billboard, before its drawing.
you will obviously need also glpushmatrix/glpopmatrix around that

float gmlmtx[16];
glGetFloatv(GL_MODELVIEW_MATRIX,gmlmtx );
// keep translation terms only (note: pGlMtx = & gmlmtx)
float rescale = 1.0f;
pGlMtx[0]=rescale; pGlMtx[1]=0.0f; pGlMtx[2]=0.0f;
pGlMtx[4]=0.0f; pGlMtx[5]=rescale; pGlMtx[6]=0.0f;
pGlMtx[8]=0.0f; pGlMtx[9]=0.0f; pGlMtx[10]=1.0f;
glLoadMatrixf(gmlmtx);

added on the 2010-03-03 14:12:08 by krabob krabob
... well the drawing after that, and the glpopmatrix after the drawing.
added on the 2010-03-03 14:13:40 by krabob krabob

login