
Half-Bilboarding
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

Are you sure it''s the normal that''s giving you the problem? Looks like the quads aren''t lining up with the edges of the holes.
I can''t believe you''re using KDE *g* (Gnome 1.4 is really sweet BTW if u haven''t already checked it out by now!)
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.
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.
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.
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.
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.
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
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
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
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
Maybe this will explain it better: Let''s say you have a spaceship with a jet engine that shoot fire
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
/-| / |=|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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement