Jump to content
The Dark Mod Forums
Sign in to follow this  
RPGista

Ambient light based on player

Recommended Posts

So I was playing the alpha game from the guys that created Penumbra and I noticed they had a neat simple feature in regards to the way ambient light works - like Doom3/TDM, in that game if there are no ambient lights in the map, shadows are pitch black, but there's a radius around the player inside which details start to become visible (around 15-20 meters?) - you start to see things gradually as you aproach a pitch black area (would probably be a simple way of simulating better eye perception at close range).

 

Technically you could say its a very subtle omnidirectional lamp attached to the player, and what is good about it is that you can still see things you need when you are reasonably close to them, but far away areas are hidden from you, keeping their mysteries and surprises. Not only that, but even this simplistic aproach is a lot more realistic than TDM's ambient world light washing over the whole map as far as you can see to infinity, that literally kills the sense of darkness in several overbright missions (not even talking about the way it makes most textures look bad and washed out).

 

I was wondering if this could be added to the mod somehow as an optional feature, or if it could be accomplished by a mapper without needing to edit the engine - I can see many situations where it would be desireable to keep the player immersed in true darkness, but still able to barely see close by things as he investigates them.

 

Its hard to see in this video because there are generally lights around, but its visible in the flare scene, he throws the flare but you can see that the area around him is brighter than the far corners of the room (which are pretty much completely dark):

 

http://www.youtube.com/watch?v=YaXDvR2sw-4

Share this post


Link to post
Share on other sites

To be fair, the use of Ambient_World is supposed to be "just barely visible" and real lights are

meant to provide the illumination. Some mappers trade in brighter Ambient_World for performance

verses the former.

 

Yes, several Doom 3 mods have attached an ambient light to the player to achieve something similar

to the above. I believe the ambient in Sikkmod essentially does the same too but it's based on

Rebb's Ambient detection scheme.

 

I have noticed when I walk my dog late at night that a different effect seems to come into play.

Dim objects become blurry as they are more distant while illuminated objects seem to remain in focus

longer. This seems like a natural fit for targeted DOF...


Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

I think we should add "control doors and drawers" with mouse - then we can say we already got all what Penumbra got minus the physics :D

 

Aynway,it is a shame they dont use the D3 engine, then we could use their work, too.


"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Share this post


Link to post
Share on other sites
this simplistic aproach is a lot more realistic than TDM's ambient world light washing over the whole map as far as you can see to infinity, that literally kills the sense of darkness in several overbright missions (not even talking about the way it makes most textures look bad and washed out).

 

I agree, the world-encompassing ambient is a too simplistic approach to the problem - and a world-encompassing system was never the goal of the "improved ambient" Doom3 shaders, it was local ones.

 

Nothing should stop a mapper from using a very dark world-ambient, and strategically ( and carefully ) place local ambient lights around the map to approximate radiosity or draw subtle attention to an area.

 

I believe Penumbra doesn't even use a special type of light, but a very low standard light attached to the player view.

Share this post


Link to post
Share on other sites

If I understand correctly, since the Ambient light shader has been broken into it's own VFP in 1.08,

it will be much less expensive to use ambient lights for decoration and variation. Up till now this

has not been utilized much due to performance concerns. That said, several threads have had discussions

about what the intended Ambient_World value should be verses what mappers appear to be doing.

 

A possibly bigger problem is that some Monitors will make some Ambient_World values look too dark

while others will be too bright. End User calibration would be the key here.

 

If the Ambient_World level were strictly enforced to be very low that would curb these bad habits but

would reduce flexibility of it's use. It's probably not worth the argument to set that in stone.

Edited by nbohr1more

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites
Yes, several Doom 3 mods have attached an ambient light to the player to achieve something similar

to the above.

I just tried binding the ambient_world light to the player and the binding dosent take - whats the actual namer of the player when you want to bind things to it..?

 

I would like experiment with this and to that end -

  • reduced its radius and moved the ambient_world to the blue room (so the game dosent complaint about it being missing).
  • Then create a light with (7x7 at grid 7) normal ambient light and bind that to the player.

Share this post


Link to post
Share on other sites

Yer, been trying that also - normal light with "texture/biground1" and the following binds -

 

"bind" "info_player_start_1

"bind" "info_player_start

"bind" "player1"

"bind" "idplayer1"

"bind" "idPlayerStart"

 

- but none of the above worked, an idea on the correct entity name of the player so I can bind a light to it..?

Share this post


Link to post
Share on other sites

Ah ok, I spotted a thread you replyed to over at D3W back in 2006, and you suggested the same then. But I have no idea how to knock up said script, can anyone help with this as I would like to see how this would look in-game with tdm.

Share this post


Link to post
Share on other sites

name your light entity "player_ambient_light" then:

 

$player_ambient_light.bind( $player1 );

 

put that in the main routine of your map script.

 

(player1 is only valid in single player mode, that is why that hack will never work for MP where there are more than one player)


"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Share this post


Link to post
Share on other sites

put that in the main routine of your map script.

 

(player1 is only valid in single player mode, that is why that hack will never work for MP where there are more than one player)

 

Cool I didnt think it was gonna be that simple (I remember seeing that on D3W). And when if at all with TDM become MP, and its a simple enough change to revert the ambient world light back to std.

Share this post


Link to post
Share on other sites

$player_ambient_light.bind( $player1 );

didnt work, get an error at map start saying that "player_ambient_light" isnt an object or something similar.

Share this post


Link to post
Share on other sites

$player_ambient_light.bindPosition( $player1 );

 

void setup_objects()

{

entity light;

$light = sys.spawn( "light" );

$light.setShader( "lights/ambientlightnfo" );

$light.setRadius( 384 );

$light.setColor( .1,.1,.1 );

// $light.noShadows( 1 );

 

$light.bind( $player1 );

$light.setOrigin( '0 0 0' );

}

 

void main ()

{

setup_objects ();

sys.print( "\n Ambientlight created!\n" );

}

Edited by Xcen

Share this post


Link to post
Share on other sites

Blimey, ok - will try this when I get home, thanks!

 

One question though, will it work as its an ambient light, not a normal light..

Share this post


Link to post
Share on other sites

If I'm understanding the desired effect (that the light trails off into the distance), you wouldn't want to use the ambientlightnfo as it has 'no fall off' in the radius.

 

The problem with this approach though is that our AI depend on a world ambient in order to see in low light levels. This would be a pretty drastic change in how AI and level design interact in TDM.

 

The ambient_world used in our missions is not supposed to be very bright, it's only supposed to be used to eliminate the pitch black Doom 3 shadows. Now that it has been broken off into a separate interaction shader, the performance has increased quite a bit on my machine.

Share this post


Link to post
Share on other sites

But if I set the radius big enough (Im thinking 6x6 at grid 7) to so its the same as the usual distance the Ai would be able to see the player anyway it would be fine. Removing the ambient work light complete dosen't stop the Ai from patrolling.

 

The thing I found with the AW_light removed is a big increase in perf, one area that regularly where the DC count hits 2000 with the AWL in the usual configuration, dropped to 1300.

Share this post


Link to post
Share on other sites

It's not just for seeing the player though, the AI also need to see missing items, fallen comrades...etc. I'm pretty sure they rely upon ambient lighting to see in many cases.

 

Now that ambient lighting is properly fixed, there is really nothing stopping us from placing multiple ambient world lights in different zones of the map. Tels already came up with a great way to adjust the ambient light on the fly with the old system, but now we should be able to truly customize the experience. We just need code to support it I suppose....so that the game knows how to transition from ambient_world_1 to ambient_world_2 and onward.

 

With that type of system, the ambient lighting zones could be as big or as small as we wish them to be and completely customized for each area. I'm sure that could lead to some nice performance gains too.

 

I'm a bit apprehensive about switching to a completely different system at this stage.

Share this post


Link to post
Share on other sites
It's not just for seeing the player though, the AI also need to see missing items, fallen comrades...etc. I'm pretty sure they rely upon ambient lighting to see in many cases.

 

Yes, removing ambient_world would certainly have an impact on the AI. (though if there's no "ambient_world" the code just moves to the largest ambient and uses that instead, IIRC).

 

Frankly, I'm not sure what the problem is that a player-attached light is supposed to solve.

  • Like 1

Share this post


Link to post
Share on other sites

Frankly, I'm not sure what the problem is that a player-attached light is supposed to solve.

 

It would certainly improve performance since there would no longer be a single light being drawn over the entire map at all times, but placing multiple world ambients throughout the map would achieve the same goal and provide even more diversity in terms of scene lighting. Would make more sense to me to do it this way since it wouldn't break the existing system.

Share this post


Link to post
Share on other sites
  • Yes, removing ambient_world would certainly have an impact on the AI. (though if there's no "ambient_world" the code just moves to the largest ambient and uses that instead, IIRC).
  • Frankly, I'm not sure what the problem is that a player-attached light is supposed to solve.

 

Are you saying that having no ambient means the AI would totally blind? rather than just not be able to see the player..?

 

And mostly I am just curious to see how it looks in-game, but if if has tangible benefits and doesn't have negatively effect Ai ability to navigate then why not..?

Share this post


Link to post
Share on other sites

Are you saying that having no ambient means the AI would totally blind? rather than just not be able to see the player..?

 

Yup. The AI depend on ambient light.

 

I think that a light strapped to the player has fewer benefits than being able to create multple world ambient zones.

  • Like 1

Share this post


Link to post
Share on other sites
Would make more sense to me to do it this way since it wouldn't break the existing system.

Hmm, the map I would like to try this one has 3 Zones, and would a prime candidate for having an ambient for each zone.

Share this post


Link to post
Share on other sites

It should be possible now with the source code for us to recognize any light with ambient_world in it and treat it accordingly based on whether or not the player is standing in that zone.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...