Archived

This topic is now archived and is closed to further replies.

wolfman8k

Half-Bilboarding

Recommended Posts

wolfman8k    140
I'm working on a simple OpenGL demo. I have a wall with holes in it and light shining through. Here's a screenshot: I circled a few of the circles. The Green holes look good. The red one's don't look right and the Yellow one is almost right. I'm acheaving the volmetric light effect by just using a quad whose normal is to the right. What I need to correct the problem so all the holes will look right is to have it where the normal of each quad is pointing towards the camera, but not directly at the camera, but sorta at a 90 degree angle. What's the math for this? Also, I don't wanna get things from opengl's model matrix. I'd like to to the math by hand, because I'm drawing all the quad's in one glBegin(GL_QUADS) block. Thanks Edited by - wolfman8k on November 7, 2001 2:56:55 PM

Share this post


Link to post
Share on other sites
wolfman8k    140
The quads top is lined up with the top of the circle, and the quads bottom is lined up with the bottom of the circle.

Basicly what I need to do is rotate the quads around the depth(Z) axis so it will be facing the camera as much as possible, but I don''t know how much(what angle) to rotate it.

Share this post


Link to post
Share on other sites
wolfman8k    140
quote:
Original post by TheGilb
I can''t believe you''re using KDE *g*


I''m new to Linux, and KDE is easy to use. I think maybe later I''ll move to something lighter like blackbox.

Share this post


Link to post
Share on other sites
wolfman8k    140
Also, while I''m here, what do you think is better:
drawing the white circles as a triangle fan or as a textured masked quad?

Now I''m drawing them all in a big glBegin(GL_TRIANGLES) block. Each circle is 16 triangles. I can''t use GL_TRIANGLE_FAN because then I''d need a different glBegin() block for each circle, and I think that it would be slower.

Share this post


Link to post
Share on other sites
Put a triangle fan in a display list or a vertex array and either call the list or render the array for each hole.

That''s gotta be better. It''ll save you a whole bunch of function call overhead. Plus your code will shrink. That''s always nice.

SL

Share this post


Link to post
Share on other sites
As for math, are you looking for this?

C----->[_]

Where C is the position of your camera, [_] is your quad.

If so, V, the vector from the camera to your quad is V = Q - C. Where Q = (q1 + q2 + q3 + q4) is the center of your quad with qi being the vertices of the quad.

You want the normal to be "sorta at a 90 degree angle". Do you mean orthogonal to the V vector or the V vector itself? I don't understand what you're looking for.

BTW, I see you have Opera fired up there. Opera rules!!! It makes Mozilla/Netscape and IE look horrible. And I actually prefer KDE to GNOME, but I don't want to be starting a flame war here. Some people are religous about stuff like that.

SL

[EDIT] Crap, forum messed up my vector.

Edited by - Screaming Lunatic on November 8, 2001 4:05:40 AM

Share this post


Link to post
Share on other sites
wolfman8k    140
Maybe this will explain it better: Let''s say you have a spaceship with a jet engine that shoot fire


/-|
/ |=|88888888
/0 |
\0 |
\ |=|88888888
\-|


the 8888 are flames. Now let''s pretend that you make the flame by texturing a picture of fire on a long quad. Now you want the quad to always face the camera as much as it can, but it can only rotate around one axix relative to the spaceship.

This sorta what I wanna do

Share this post


Link to post
Share on other sites