6

I'm working on implementing Bruneton's cloud rendering paper, which requires one to render a pair of depth maps, similar to how shadow mapping works. In this case, my light source is the sun (or possibly the moon), which I represent in my rendering engine as a normalized vector pointing in the direction of the sun or moon, which is essentially located at infinity from the current camera position.

Since the light source doesn't have a traditional "position," I'm having a little trouble determining how best to create the viewpoint transformations for the source.

Since I would also essentially use the same transformation for sun/moon shadowing, it'd kill two birds with one stone.

So my question is thus: How can I generate a view transform for generating depth maps of area light sources located at infinity?

stix
  • 163
  • 4

1 Answers1

5

Instead of using a perspective projection you would use a orthographic projection.

Then the trick is to position the bounding box to in front of the normal camera.

An additional option is to add a skew/shear operation so it maps the light direction to the vertical and keeps the horizontal ground plane horizontal.

This avoids leaving a large dead zone underground near the light source.

ratchet freak
  • 5,830
  • 15
  • 27