Archived

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

Lightning and blending effects

This topic is 5675 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites