Skip to main content
gamedev.net
🔒 Locked

Multiple shadow maps into one Pbuffer/Framebuffer

Started by GOCP Nov 15, 2005 at 8:12 AM 2 replies 1k views
Original Post
GOCP
GOCP
Hi, I'm aiming to use a large number of lights casting shadows. My goal is to share one pbuffer/framebuffer between multiple lights. Rendering into each section per light is trivial, what I can't figure out is how you setup the texture matrix only to use part of the shadow map when doing the depth comparisons. Anyone done work on sharing one buffer between multiple lights? GOCP
AndyTX
AndyTX
Probably easiest to do in a shader... (everyone should be using them for everything by now :)).

That said if you can't do that for some reason, won't the texture transform be a simple 2D scale and bias? Am I missing something?

i.e. if your desired area (in texture space, 0->1) is (x1,y1)->(x2,y2):
Matrix is something like:
(x2-x1)    0     x1   0    (y2-y1)  y1   0       0      1

Note that you may have problems with out-of-bounds accesses which could much more easily be handled/clamped in a fragment program :)
GOCP
GOCP
Ok, from first looks at it you are on the money. Clamping is a bit of a pain - however it works beyond that (well with a bit of fiddling).

As ever if you look at something too long you'll miss the obvious answer. Now to fix the clamping and it's sorted.

GOCP

Topic Locked

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

Sign in to reply to this topic.