Lightning and blending effects

Started by
1 comment, last by tiutiu 21 years, 10 months ago
Hi i want to learn how to do the lighning and blending effects like when in a rpg someone casts a spell. Look at this screenshot and see what im talking about http://www.risingphoenix.org/DAoC/gif/cosmo/sshot074.jpg
Advertisement
thats an alpha blended texture.
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

requires the texture to be 4 component, not 3 (ie, tga, dds, etc) where the 4th, the alpha component, sets how transparent the pixel is to be drawn. Hence the combination above:

GL_SRC_ALPHA -> multiply the colour of the incomming texture by the alpha component
GL_ONE_MINUS_SRC_ALPHA -> multiply the existing pixel's colour by 1 minus the alpha value...

eg, if the alpha is 25% (64 in byte form), the incomming pixel is multiplied by .25, while the pixel already on screen is multiplied by .75

[edited by - RipTorn on June 2, 2002 12:53:12 AM]
Well if you want to do spell effects you are going to most likely use a partical system for Particals and Use your blending to make them transparent but in this picture if you look at the spell effects in that picture all you will see is blended particals at full brightness. Those Spells are not lit at all if you want something like that then

glPushMatrix();
Disable lighting
use glColor4f(); for Alpha and Colors

then bind your textures
then draw everything.

glPopMatrix();

build off of this simple idea.

good luck
"I seek knowledge and to help those who also seek it"

This topic is closed to new replies.

Advertisement