In a lot of 1st person shooter games now, the player has the ability to turn on and off a flashlight that is used to illuminate the scene (ie F.E.A.R or Half-Life 2)
I was wondering how to implement this in the game engine. I tried assigning a spot light source to my player but the resolution of the objects in my scene must be really high for the flashlight to look circular. The light sources in OpenGL are only vertex (not pixel) based so this doesn't work very well.
Any help would be greatly appreciated.
How to implement a flashlight effect
Started by marek-knows.com, Jan 09 2007 01:38 AM
4 replies to this topic
#1
Posted 09 January 2007 - 01:38 AM
3D OpenGL, C++ Game Development Video Tutorials @
www.marek-knows.com
www.marek-knows.com
#2
Posted 09 January 2007 - 01:43 AM
Try using a projective texture, preferably with shadow-mapping.
#3
Posted 09 January 2007 - 02:50 AM
Most games nowadays use per-pixel lighting with shaders, not the OpenGL built-in vertex lighting.
reedbeta.com - developer blog, OpenGL demos, and other projects
#4
Posted 09 January 2007 - 04:19 AM
kusma said:
Try using a projective texture, preferably with shadow-mapping.
I'm not familiar with projected texture mapping. I'll have to look this up to see what you mean. Do you have any good resources demonstrating this technique?
3D OpenGL, C++ Game Development Video Tutorials @
www.marek-knows.com
www.marek-knows.com
#5
Posted 09 January 2007 - 05:26 AM
The idea is that you're projecting a texture from a light source onto geometry. This allows the directional distribution of light to be shaped very precisely. If you've played Doom 3, do you remember the spinning ceiling fans that cast soft shadows on the floor? Those were done with projective textures.
The technique is basically like shadow mapping. Where in shadow mapping, you have a depth texture and a depth comparison, for projective texture lighting you just have an ordinary RGB texture that multiplies the light's brightness. And it can be combined with shadow mapping as well, as kusma noted.
The technique is basically like shadow mapping. Where in shadow mapping, you have a depth texture and a depth comparison, for projective texture lighting you just have an ordinary RGB texture that multiplies the light's brightness. And it can be combined with shadow mapping as well, as kusma noted.
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












