Skip to main content
gamedev.net
🔒 Locked

lightning

Started by Xyan Dec 24, 2001 at 1:36 AM 2 replies 300+ views
Original Post
Xyan
Xyan
Can I use alpha blending to simulate light. It seems that lighting is almost never api based and games use their own lighting tricks. Will this change because of t&l(especially l)features of graphic cards? Edited by - Xyan on December 24, 2001 2:37:19 AM Edited by - Xyan on December 24, 2001 2:49:03 AM Edited by - Xyan on December 24, 2001 9:12:06 AM
Xyan
Xyan
Come on????
Gorky
Gorky
Alpha blending just makes things generally see through or not.

I doubt there is a trick to make things brighter.
S1CA
S1CA
"Additive" blending.

ResultRGB = 1*SrcRGB + 1*DestRGB

In D3D, set the SRCBLEND renderstate to D3DBLEND_ONE and the DESTBLEND renderstate to D3DBLEND_ONE.

IIRC, the OpenGL call is glBlendFunc(GL_ONE, GL_ONE).

The basic idea is to add the current pixel to the pixel already in the framebuffer in some way.

You can get even more sophisticated if you replace one of the 1 factors with the value from the alpha channel, for example:

ResultRGB = SrcA*SrcRGB + 1*DestRGB


BTW plenty of games already use API based vertex lighting combined with pre-canned vertex lighting and lightmaps (blending a texture which represents the light with polygons in the scene).

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.