Lights sourced from an area instead of a point?

BigDBigD [OldF] Join Date: 2002-10-25 Member: 1596Members
edited December 2009 in NS2 General Discussion
<div class="IPBDescription">AKA Halflife texture lighting</div>Maybe I missed a memo somewhere (entirely possible), but can we make lights come from an face/model/whatever instead of the omnidirectional and spot lights coming from a point? Something akin to the texture lighting of olden days? I ask because I was just playing around with one of the light models turned on its side trying to make a long "light pipe" of sorts and this question popped in my mind. The light model itself is "lit" but doesn't emit? Or am I doing it wrong?

(For those who don't know what I'm talking about: compare a long fluorescent bulb or neon light compared to an incandescent bulb.)

Edit: Obviously, texture lighting as it was done in HL probably can't be done. I just used it as an example of area-sourced lighting.

Comments

  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    Not unless you want to render hundreds of lights for a single texture.
  • EmooEmoo Ibasa Join Date: 2002-12-20 Member: 11198Members
    Yeh real area lights are hard to render. But what they might add is an illumination map to textures which doesn't acctully emit light but renders those parts of the texture at a certain level even if there's no light shining on them.
  • XuaxinodalXuaxinodal Join Date: 2002-12-19 Member: 11158Members, Constellation
    I too have thought about the "classic" texture lighting as it could be very useful in certain cases. I think if it was handled by chopping the face into lots of pieces it would probably cause too much overhead to be worth its while.

    I think it would have to be done by creating a single light source based on face geometry; something along the lines of selecting an existing face and then perform "create face light" where it turns the face into a spot light entity. The "face light" would have all the same properties as a spot light but the directional vector would be fixed as being perpendicular to the face.

    Theoretically it's do-able but I don't know how much of a nightmare it would be to code that into the engine.
  • ozbirdboyozbirdboy Join Date: 2007-08-07 Member: 61827Confirm Email
    It would be good to have some kind of feature similar to that of the lights.rad file from HL; however this may not be necessary in NS2.

    Time will tell.
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    from what i remember, lava in NS2 does glow, so the possibility should be there to make it more generic
  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    edited December 2009
    <!--quoteo(post=1743750:date=Dec 14 2009, 08:59 AM:name=Asraniel)--><div class='quotetop'>QUOTE (Asraniel @ Dec 14 2009, 08:59 AM) <a href="index.php?act=findpost&pid=1743750"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->from what i remember, lava in NS2 does glow, so the possibility should be there to make it more generic<!--QuoteEnd--></div><!--QuoteEEnd-->

    Or alternatively put a single light in the middle of the lava pool and save rendering hundreds of lights.

    There's a reason level designers and artists exist, and that's because making levels and art <i>requires work.</i>

    There really is no substitute for intelligent work by the artist.
  • SewlekSewlek The programmer previously known as Schimmel Join Date: 2003-05-13 Member: 16247Members, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Developer
    eh, a light sourced from a face (or faces) is nothing else than a point light with limitations in is angle. Ok stupid explanation, but its like you put a point light behind a wall which has a window, light will come only through this window. So if you imagine this window as a face, then this face is casting the light you see (if you ignore the faces which you dont see now). The distance of this light to the window is defining the angle of the light source. Its not 100% physical exact, but its giving you a proper illusion of a surface generated light. so "no" to what stated above, its not decreasing performance if implemented like this
  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    <!--quoteo(post=1743755:date=Dec 14 2009, 11:18 AM:name=Schimmel)--><div class='quotetop'>QUOTE (Schimmel @ Dec 14 2009, 11:18 AM) <a href="index.php?act=findpost&pid=1743755"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->eh, a light sourced from a face (or faces) is nothing else than a point light with limitations in is angle. Ok stupid explanation, but its like you put a point light behind a wall which has a window, light will come only through this window. So if you imagine this window as a face, then this face is casting the light you see (if you ignore the faces which you dont see now). The distance of this light to the window is defining the angle of the light source. Its not 100% physical exact, but its giving you a proper illusion of a surface generated light. so "no" to what stated above, its not decreasing performance if implemented like this<!--QuoteEnd--></div><!--QuoteEEnd-->

    Actually for that we have the ability to use the exclude function.

    3d packages let you set certain objects to not be affected by lights or to not cast shadows from those specific lights. So you COULD put a light some distance behind the wall and have it cast through it to simulate area emission.

    Much cheaper to do, but requires more work to set up.
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    To the best of my knowledge, no such thing is possible with dynamic lighting. We should have projector maps though.

    And maybe area lights - but that's never been even hinted at, so that's speculation on my part.
  • KarrdeKarrde Join Date: 2003-05-13 Member: 16264Members
    Yeah some sort of illumination map on the textures should work. I think they do that in Source IIRC. I remember messing with the TF2 theme changer sourcemod plugin and certain bits of geometry wouldn't change their lighting no matter what I did, so it has to be some map inherent in the textures.
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    <!--quoteo(post=1743762:date=Dec 14 2009, 03:11 PM:name=Karrde)--><div class='quotetop'>QUOTE (Karrde @ Dec 14 2009, 03:11 PM) <a href="index.php?act=findpost&pid=1743762"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Yeah some sort of illumination map on the textures should work. I think they do that in Source IIRC. I remember messing with the TF2 theme changer sourcemod plugin and certain bits of geometry wouldn't change their lighting no matter what I did, so it has to be some map inherent in the textures.<!--QuoteEnd--></div><!--QuoteEEnd-->
    You might be thinking of the glow mapping on the textures themselves. NS2 can and already does do that.

    Projecting light one the external geometry is, however, a lot more tricky. Source can do that because it works with literal light rays (a couple of rays for every pixel on the texture), which isn't really an option for real-time lighting.
  • XuaxinodalXuaxinodal Join Date: 2002-12-19 Member: 11158Members, Constellation
    <!--quoteo(post=1743755:date=Dec 14 2009, 06:18 AM:name=Schimmel)--><div class='quotetop'>QUOTE (Schimmel @ Dec 14 2009, 06:18 AM) <a href="index.php?act=findpost&pid=1743755"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->eh, a light sourced from a face (or faces) is nothing else than a point light with limitations in is angle. Ok stupid explanation, but its like you put a point light behind a wall which has a window, light will come only through this window. So if you imagine this window as a face, then this face is casting the light you see (if you ignore the faces which you dont see now). The distance of this light to the window is defining the angle of the light source. Its not 100% physical exact, but its giving you a proper illusion of a surface generated light. so "no" to what stated above, its not decreasing performance if implemented like this<!--QuoteEnd--></div><!--QuoteEEnd-->

    Yes, that is one of the ways I was thinking it could be done: knowing the direction of the light (determined by the 3D orientation of the face) and knowing the desired brightness angle for the light, one can extrapolate "backwards" from each point of the face to find a single point where all the vectors meet; this is the point where the light entity would be placed. All of this would be done internally by the engine to save the mapper from having to re-calculate every time they wanted to change the angle of the light.

    The only issue I would foresee with this method is if someone were to create a large "face light" that the light entity could end up in another visible area of the map. To this end, I don't think an actual light entity could be used like this but rather the calculations I stated above would be done internally and then have the light "start" at the face and not the light entity point.

    -----

    The other method I was thinking of was to use a geometric scaling translation of the face to "project" light onto various surfaces. In this method, the face would be scaled and translated so that light would be cast using the shape of the face onto whatever surfaces are in its path. The max distance property would determine how far out the shape is translated and the inner/outer angle properties in conjunction with the max distance property would determine the scaling needed. Intensity would still apply like normal.
  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    edited December 2009
    <!--quoteo(post=1743769:date=Dec 14 2009, 12:46 PM:name=Draco_2k)--><div class='quotetop'>QUOTE (Draco_2k @ Dec 14 2009, 12:46 PM) <a href="index.php?act=findpost&pid=1743769"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You might be thinking of the glow mapping on the textures themselves. NS2 can and already does do that.

    Projecting light one the external geometry is, however, a lot more tricky. Source can do that because it works with literal light rays (a couple of rays for every pixel on the texture), which isn't really an option for real-time lighting.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Actually source does it a bit simpler than that.

    Every repeat of the texture gets a light in the centre.

    So if you have the texture filling the whole face once, you get one light.

    If you have a small texture tiled many times, you get many lights.

    Honestly area lights are not needed, they do nothing you can't simulate with intelligent use of point lights at much lower cost and with much greater control.

    They really are entirely pointless, especially in a game environment.
  • crodecrode Join Date: 2002-11-09 Member: 7876Members
    You cant realistically do faked area lights using point lights if all the shadows are hard. And it seems the shadows are showing all hard so far.

    Doing the area light is easy enough as long as they are not dynamic. Its how the shadows are handled since they will have to be soft (gradient like). Using ray tracing it is very slow since to make soft shadows look nice you need huge numbers of samples, 64 samples is 64 times slower. Its easy for HL/HL2 since this is precalculated when compiling and can do light bouncing etc.

    It would be good, even necessary, to have some type of soft shadows for NS2 for realism. Hoping for ambient occlusion too ;)
  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    NS2 has soft shadows, they're in a lot of the screenshots, hard shadows is doom 3.

    Whether or not you can control the softness on a per light basis is another issue, but it does have soft shadows.
  • KarrdeKarrde Join Date: 2003-05-13 Member: 16264Members
    <!--quoteo(post=1743769:date=Dec 14 2009, 07:46 AM:name=Draco_2k)--><div class='quotetop'>QUOTE (Draco_2k @ Dec 14 2009, 07:46 AM) <a href="index.php?act=findpost&pid=1743769"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You might be thinking of the glow mapping on the textures themselves. NS2 can and already does do that.

    Projecting light one the external geometry is, however, a lot more tricky. Source can do that because it works with literal light rays (a couple of rays for every pixel on the texture), which isn't really an option for real-time lighting.<!--QuoteEnd--></div><!--QuoteEEnd-->


    That's exactly what I was talking about, not having it be an actual light source. Just simulating "brightness".
  • Draco_2kDraco_2k Evil Genius Join Date: 2009-12-09 Member: 69546Members
    <!--quoteo(post=1743920:date=Dec 15 2009, 09:00 PM:name=Karrde)--><div class='quotetop'>QUOTE (Karrde @ Dec 15 2009, 09:00 PM) <a href="index.php?act=findpost&pid=1743920"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->That's exactly what I was talking about, not having it be an actual light source. Just simulating "brightness".<!--QuoteEnd--></div><!--QuoteEEnd-->
    Yep, that's in. Try placing some computer-like prop without any lights in lit mode.
  • KarrdeKarrde Join Date: 2003-05-13 Member: 16264Members
    Hmmmm, wonder if they'll allow for the options to adjust the "brightness" of the map on the fly on all textures. Would be nice for providing illusions of lighting in certain situations. IE you want the area brighter but don't wanna place more lights.
  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    <!--quoteo(post=1743960:date=Dec 15 2009, 11:20 PM:name=Karrde)--><div class='quotetop'>QUOTE (Karrde @ Dec 15 2009, 11:20 PM) <a href="index.php?act=findpost&pid=1743960"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Hmmmm, wonder if they'll allow for the options to adjust the "brightness" of the map on the fly on all textures. Would be nice for providing illusions of lighting in certain situations. IE you want the area brighter but don't wanna place more lights.<!--QuoteEnd--></div><!--QuoteEEnd-->

    That's what ambient lights are for, place one in the area to set the background light.
Sign In or Register to comment.