16
Scripts, plugins, utilities, goodies / Re: Flashlight script
« on: May 21, 2007, 08:03:04 PM »
This reminds me of Alone in the Dark 4. Ever played it? It features prerendered backgrounds, but the character's flashlight can "light up" the darkened backgrounds. The cool thing is that it also creates shadows based off the flashlight's position, and they react appropriately to the flashlight. Would it be possible, in WME, to make the dynamic shadows react to the light cone?
You'd have to get the 3D coordinates based off the center point of the flashlight cone and trace from the player's world position to this vector in the level. Everything within the circular light cone would need to be influenced, of course.
I'm not sure right off the top of my head how to do this in WME, but what I described above is a start I suppose. There's a PC demo of the game floating around if you want to see the effect first hand. It's not the greatest game, but the effect is nice.
EDIT: Actually, I just played it, and it doesn't cast shadows, so I'm wrong about it. The flashlight is projected onto the walk plane, though and it lights up parts of the background it touches nicely. It looks like a real directx light because of an obvious tessellation effect.
You'd have to get the 3D coordinates based off the center point of the flashlight cone and trace from the player's world position to this vector in the level. Everything within the circular light cone would need to be influenced, of course.
I'm not sure right off the top of my head how to do this in WME, but what I described above is a start I suppose. There's a PC demo of the game floating around if you want to see the effect first hand. It's not the greatest game, but the effect is nice.
EDIT: Actually, I just played it, and it doesn't cast shadows, so I'm wrong about it. The flashlight is projected onto the walk plane, though and it lights up parts of the background it touches nicely. It looks like a real directx light because of an obvious tessellation effect.