Skip to main content
gamedev.net
🔒 Locked

does shadow mapping require an additional render pass?

Started by ehmdjii 6 replies 1.3k views
Original Post
ehmdjii
ehmdjii
hello, is there a possibility to implement shadow mapping without an additional renderpass? if so how? the problem is that i already have two passes and i want to avoid another one just for the shadows.
jpetrie
jpetrie
Construction of the shadow map involves rendering the scene from the light's point of view. Unless you happen to also be viewing the scene from the light's point of view (in which case no shadows will be visible from that light), you can't really escape doing an extra pass for it.
vincoof
vincoof
Not sure what is the question here.

Shadow-mapping requires that you render at least two scenes : the scene from each light position (more precisely, each light you want to project shadows, because many insignificant little glowing light sources don't really need shadows) and, of course, the scene from the viewer's position.

But if you want to save multi-pass because for instance you're rendering your main scene to a big FSAA'ed screen, you don't really need to render your scene multiple times from the viewer's position. With some finely tuned shaders, and thanks to shader support on the hardware if you have the chance to use pixels shaders, you can render you "viewer's scene" with shadows in the same pass that another pass for the same scene. However, you still need to render the "light scene" for each light, but for this scene you generally use a different buffer (off-screen rendering) which is smaller, eg 128x128, which optimizes fillrate and texture transfert, but also may reduce image quality (all in all you always have to balance performance and quality obviously).
ehmdjii
ehmdjii
ok, thanks.

how do i render to such an off-screen buffer?

by "render pass" i meant a complete frame (glClear()).
andyZER0
andyZER0
You can do so by using things like FBO's (Frame buffer objects).

GameDev's got articles on them:
http://www.gamedev.net/reference/programming/features/fbo1/
http://www.gamedev.net/reference/programming/features/fbo2/
_the_phantom_
_the_phantom_
for the record; a 3rd, and final, part is in the works showing how to shadow map with the FBO extension and glsl...
ehmdjii
ehmdjii
ok thanks, but is there a solution to render to texture without using an extension like frame buffer object? (plain old opengl 1)

thanks?

_the_phantom_
_the_phantom_
you'd have to copy the framebuffer to a texture (glCopySubTexImage & glCopyTexImage iirc).

however, you can't do shadow mapping with just plain OGL1.1 as it lacks all the shadowing extensions...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.