Author Topic: Additive texturemode?  (Read 4408 times)

sfx1999

  • *
  • Posts: 1142
    • View Profile
Additive texturemode?
« 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?

Kislinskiy

  • Guest
Additive texturemode?
« Reply #1 on: 2004-08-23 08:45:25 »



Cyberman

  • *
  • Posts: 1572
    • View Profile
Additive texturemode?
« Reply #2 on: 2004-08-23 14:06:38 »
I wasn't sure what he was asking either, however that was my guess as well.

sfx1999 goto
NeHe Productions.
They have some great stuff there and the texture blending tutorial they have is probably one of the best.

Cyb

sfx1999

  • *
  • Posts: 1142
    • View Profile
Additive texturemode?
« Reply #3 on: 2004-08-23 16:04:40 »
So it is supposed to make it look washed out. I see now. That's what I needed to know.

Cyberman

  • *
  • Posts: 1572
    • View Profile
Additive texturemode?
« Reply #4 on: 2004-08-23 18:55:52 »
Quote from: sfx1999
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
Code: [Select]
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!

sfx1999

  • *
  • Posts: 1142
    • View Profile

Cyberman

  • *
  • Posts: 1572
    • View Profile
Additive texturemode?
« Reply #6 on: 2004-08-24 00:14:14 »
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.

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

sfx1999

  • *
  • Posts: 1142
    • View Profile
Additive texturemode?
« Reply #7 on: 2004-08-24 01:20:50 »
They use Kislinskiy's way because OpenGL has direct support for it. That lightmap method requires a bit of computation.