How to make a poly always face the viewer?

Hi!
Calm down…I know this question was asked here a thousand times…But I cannot find it by searching the forum.
Can anyone give my a link or tell me for what I have to search to find one of these old topics?

Thanx in advance, XBTC!

Hi XBCT !

Looking forward to improve your Q3 viewer ?

I posted some code here:
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/001397.html

The keyword to find that type of thing is “billboard” !

Regards.

Eric

First of all thanx alot for your answer…

>Looking forward to improve your Q3 viewer? <

Hehe yep I´m going beyond Q3 now…
I want to implement those UT-style coronas in my Q3Viewer now…

I need billboarding(Thanx for the word )
to make them always face the viewer.

Anyway your link is exactly what I need…

Greets and thanx, XBTC!

If I may add my two cents: if you have the modelview matrix, you can trivially extract the right and up vector of the camera:
(cam is float[16] modelview matrix after applying rotation and translation):

inline vec3_t right_vector() const {
return vec3_t(cam[0],cam[4],cam[8]);
}
inline vec3_t up_vector() const {
return vec3_t(cam[1],cam[5],cam[9]);
}

Having these two, it’s very easy to make a polygon always face the camera…

just a hint…

Why does everyone write a q3 thing.
At the end, what did you do. Did you write a program that can read the bsp files and supports shaders or what? A complete q3 clone? Virtual machine?

I’m only a newbie but I just unprojected to make billboards, i.e I simply unrotated. This worked fine for me - It was for a tree.

All this talk of Q3. I’m making UT ( the export features on UT editor are great) Now I have gathered all sound, music and textures. The exported file is not to hard to understand. I suggtest anyone with unreal or UT to have a look.

Hehe , I decided to go with ASCII UnrealEd exported files when I noticed I could even use my object definitions via dummy actor code (UnrealScript used just to get the object data members to appear in the UnrealEditor).

Hi!
First of all thanx for all your answers…

Beavis: Yep this seems to be the best way…
It´s the same thing Nate describes in his Billboarding-Tute…

Michael: Yes my Q3Clone reads the bsp-files of Q3 and tries to do everything the original does…
The rendering part(shaders+lighting,beziers)
is complete now and you won´t be able to distinguish it from the real Q3 without looking very close…
I spend my time optimizing now but I think I have already 75% of Q3´s speed(Don´t forget that I don´t do all the physics\collision\ai stuff Q3 does…).
But I do it all just for learning…

Tim:What do you mean with unprojecting?

P.s.:Where did you get infos on UT guys?I first wanted to code a UT viewer but I weren´t able to find any info on it…

Greets, XBTC!

[This message has been edited by XBCT (edited 01-12-2001).]

Unprojecting- bad choice of word but this is what I did:

I moved and rotated the camera like this -
glRotatef(xamount,1.0f,0,0);
glRotatef(yamount,0,1.0f,0);
glTranslatef(xtrans, ytrans, ztrans);
(gluLookAt also works)
Then I rendered the scenery and if I wanted to draw a tree I would do this-

glTranslatef(10,0,0); // move to tree
glRotatef(yamount,0,-1.0f,0); // note negative
Then I would rerotate back when finished.

Simple and has major problems(speed) but works. This works for a vertical tree rotating around the yaxis to make it rotate about the x axis is just as easy and will work for UT style light flares I think.

I don’t actualy know much about the UT file info but I did reconize the important stuff i.e vertices, normals, texture UVs. I might ask DFrey if I cant figure out some of the stuff(The way the texture UV are used - there are 3 sets for a square and 2 for a triangle …?).

Tim

Hi!
Thanx for replying…
Tim: Your approach would work but I think I´ll stick with the nate\beavis method for flexibility + speed…
What UT format are you talking about?
The UnrealED text export or the real compiled level-file?

Thanx in advance, XBTC!

You could also just have a seperate 2d matrix.

I did say there were problems(speed). I’m talking about the exported text.

[This message has been edited by Tim Stirling (edited 01-13-2001).]

Thanx for replying…
Tim: Did you figure out UT´s TextFile Format
yourself(I looked into it and it doesn´t look too difficult) or are there some other sources explaining the format?
The only thing I don´t understand:
Why everything is called an actor?
Static geometry doesn´t act too much…

Greets, XBTC!

I figured it out my self but I would be interested if there were anything that explains the files ( the more complex actor stuff?, sound etc.) I would also Like to know If anyone has the helpfiles for the editor becuase in both unreal and UT there is no helpfile and I can’t figure out how to texture my own simple test cubes etc.