PDA

View Full Version : Blending for Clouds....



OGL_PGR
07-13-2005, 09:01 PM
I have two 512x512 32-bit cloud like bitmaps.

I've placed one slighty above the other.

( layer-1 at y, and layer-2 at y+1 ).
Camera is at Origin looking at +Y-Axis.

I want to use BLENDING to make the bottom layer semi-transparent so that both the layers can be seen.

Thanks.

T101
07-13-2005, 10:09 PM
http://www.rush3d.com/reference/opengl-redbook-1.1/chapter07.html

You'll probably want to use

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);b efore you render your clouds (don't forget to disable blending before you render normal geometry again).
Also, with this type of blending, you'll have to ensure that you render back to front, and it's generally a good idea to enable the depth test but disable depth writes when you render transparent textures.

You'll have to make up your own mind on whether or not you want to use an alphachannel for blending.

If the whole bottom texture is cloudy but with lighter and darker areas, you'll probably get a good effect with just a fixed alpha for the whole quad. If you're going for loose clouds, use an alpha channel in the texture.

OGL_PGR
07-15-2005, 12:30 AM
Thanks T101 !

Problem-2:

Could you please give me some pointers on 2nd order interpolation ? ( i.e using velocity and acceleration. )

input data :
time(s) ; X(m) ; Y(m) ; Z(m)
0.1 0 1.2 0
0.2 0 2.0 0
0.3 0 3.0 0
0.4 0 4.5 0
0.5 1 7.0 0.5
... ... ... ...

col1=time (in seconds).
col2=X coord of object in metres.
col3=Y coord of object in metres.
col4=Z coord of object in metres.

thanks.