How to make a prop dynamic receive correct shadow as it moves?

Banni

L1: Registered
Aug 26, 2008
24
2
Guys,
I'm trying to do a simple 'train through a dark tunnel' feature (like the ones in Well). I've got the train moving happily around a loop (prop_dynamic parented to a func_tracktrain). The problem I'm having is the the prop (bomb_cart.mdl in this case) is always light as it appears in its initial position. What I want to happen is that it comes out of a dark tunnel, gets brighter as it passes the player standing on the platform, then as it disappears down the tunnel, it gets darker again. Looking closely at the trains in Well, when they are in the tunnels either side of the map, they are darker. Once they come out into the sunlight, they brighten up. Therefore it does seem to be possible to achieve the effect I want.
Can anyone please suggest what I'm missing to make this work? Cheers
EDIT: The screenshots show the train as it first appear in the dark tunnel, yet it is still brightly lit. The lighting stays constant all the way along the tunnel.
 

Psyphil

L3: Member
Nov 6, 2007
125
60
I believe I heard somewhere that the well train is 2 trains, one in the skybox and then with perfect timing it meets with one inside the map.
but I'm not sure
 

Banni

L1: Registered
Aug 26, 2008
24
2
I think you're referring to this from the developer commentary notes:
We build our 3d skyboxes at 1/16th scale to reduce the memory used by the large spaces in them. This means we have to get a little tricky when dealing with trains moving between the skybox and the player space. There are actually two versions of each moving train; A player-scaled one for the actual gameplay space, and a tiny one out in the skybox. The small repair sheds on either side of the middle building disguise the point at which we swap between the two trains.
AFAICT the transition is purely so they can switch between a skybox (1/16th) model and the real model. The shed in Well just outside the playable area where you lose sight of the train briefly seems to be where this happens. Once the train comes out the the shed, there is still a visible transition of its lighting state. It's this transition I'm trying to reproduce. Perhaps I should look at a decompiled version of well...
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Nah, u'll need either light_dynamic or several prop_dynamics with different lighting.

I'm not sure about this because the cart in goldrush and in hoodoo change shading as they move. I have a feeling it might be related to the VVIS settings you might be using, if not try using this and see if that works.
 

UKCS-Alias

Mann vs Machine... or... Mapper vs Meta?
aa
Sep 8, 2008
1,264
816
Note that the cart in the the valve payload maps is a prop_physics with motion disabled in the start (parented to the tracktrain). If im right prop_physics objects recieve light better prop_dynamic so its worth a try.

The train in well is indeed a prop_dynamic but i guess its way of recieving shadows is defined in the vtf files in a diffirent way then the cart.

Anyway, just try it out and see if it works.
 

Banni

L1: Registered
Aug 26, 2008
24
2
Thanks for your comments. Now for some follow up:

I changed the model from the bomb cart to the same train engine as used in Well. At first this appeared completely black as it went down the tunnel, rather than fully lit like the bomb cart. After tweaking things, I eventually fixed it (for the train model) by tweaking the lighting values (I'd initially set the falloff distances too low). Now the train (func_tracktrain + prop_dynamic) travels down the tunnel out of the darkness, gets brighter as it comes under the lights, and then gets darker again as it moves into the shadows. Perfect!

If I change the prop_dynamic to use the bomb cart model (without changing anything else at all), then the cart stays fully lit at al times. It seems there might be something in the cart's material that behaves differently from the train's.
That does fit with the post above somewhat, so I'll try experimenting tonight with the bomb cart as a prop_physics rather than a prop_dynamic, and see how it goes.

For reference, all my lights are static (a mixture of light and light_spot entities).