Computer Graphics Stack Exchange is a question and answer site for computer graphics researchers and programmers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.