Lighting and Shadows in pre-rendered scene..!

Hey there,

Once again I’m in great need of your expertise!

I have this pre-rendered scene consisting of a 2D image which is rendered to a 2D quad (taking up the whole screen, of course).
Until now I wanted to use a depth map to make it possible to make dynamic characters and objects to be clipped behind some of the pre-rendered image’s “objects”.
However, when I began thinking of dynamic lighting and dynamic shadows I stumbled upon a few problems.
For one thing, since I’m (currently) not loading any vertices I don’t know how I could achieve the lighting and shadow thing.

I see two possibilities here:

  1. Draw some simplified version of the mesh every frame for use in lighting and shadowing calculations (maybe not even draw, but just use the 3D info directly…).
  2. Calculate e.g. the shadow volumes and use the depth map to find which pixels are inside these volumes and should be darkened.

I don’t know if any of these methods are preferable, but I’d certainly prefer some feedback from the great minds of you guys :wink:

Huge thanks in advance,

To perform dynamic lighting,you must be able to know the (eyex,eyey,eyez) position of each fragment of the prerendered scene in eye space,and also have a normalmap of the scene.Since you have (winx,winy,winz) in window space,you should be able to compute (eyex,eyey,eyez) with something like gluUnProject and compute the L,V,N vectors for lighting,preferably using fragment shaders:
L=dynlightpos-(eyex,eyey,eyez);
V=-(eyex,eyey,eyez);
N=normalmap;