Qhimm.com Forums
Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: sfx1999 on 2004-08-23 00:28:41
-
I was wondering how an effect was achived in Half-life. What happens is you set a texture to additive and it lights up the stuff behind it (it is useful for lightbeams coming off lights and rotating ones). Does anyone know how this would be done in OpenGL?
-
(http://forum.jurawelt.com/images/smiles/icon_question.gif)
(http://home.arcor.de/kislinskiy/add.jpg)
-
I wasn't sure what he was asking either, however that was my guess as well.
sfx1999 goto
NeHe Productions (http://nehe.gamedev.net/).
They have some great stuff there and the texture blending tutorial they have is probably one of the best.
Cyb
-
So it is supposed to make it look washed out. I see now. That's what I needed to know.
-
So it is supposed to make it look washed out. I see now. That's what I needed to know.
When you add a texture to another texture like that, and you exceed the maximum pixel threshold
IE
RGBA 0x78, 0x90, 0x78, 0x00 + 0x70, 0x80, 0x70, 0x00 = 0xE8, 0xFF, 0xE8, 0x00
It should tend toward 'clamping' the upper values. This can give it a washed out look unfortunately. If you wish to have a better method then you should use OGL's lighting model. You need the normals for each corner of the polygon then compute the brightness for each corner. Commonly guruad shading is used across the polygon to give the right look.
Of note NONE of the FF series 3d engines use light shading! If they did the models would look too dark very likely.
What are you trying to do? We might be able to help you get there with less pain! (maybe)
Cyb - Good fortune with your experiments!
-
http://collective.valve-erc.com/index.php?doc=1046743636-79563600
Like that.
-
Ahhh.. hmmm. You'll need to blend the texture at interesting angles then. The fun part comes if you have a repeating texture or the light map texture exceeds the perimeter of the polygon. If that happens you will need to examine each polygon and comput the cliping then blend the texture for those polygons as well. The fun part might be a ceiling which requires a different light map texture pattern to blend. Woo hoo.
Here is a better looking example and more realistic as well.
(http://www.geocities.com/cyberman_phillips/LightRoom.jpg)
Notice the light maping on the floor and wall match the correct light pattern. Granted it was a cheesy thing to whip together but that is more realistic than the half life example. I believe they might be just taking the 3d image and blending the light map into that image, giving you that well result. It's 'OK' looking at least.
Cyb
-
They use Kislinskiy's way because OpenGL has direct support for it. That lightmap method requires a bit of computation.