x


Shadows and the camera projection matrix

Hi all,

I've built an application in the free version of Unity which allows several instances to connect to a server over a LAN. Each client sees the scene through the server's camera. From here, the server modifies values of the clients' projection matrices so that the client windows can be positioned around each other to draw one whole merged image from all the windows. Eventually this will be used with several projectors to get a high-res scene.

Upon activating my Unity Pro trial and activating shadows, I have found that the clients with modified projection matrices have either flickering shadows (soft and hard), or have weird dark/light distortions around where shadows should and shouldn't be.

There are 2 methods of modifying the matrix which I am using:

  1. 'Sliding' the visible portion of the viewing plane sideways, for projecting onto a flat surface. This creates an asymmetric viewing frustum.
  2. Applying a rotation matrix to the projection matrix, used for projecting onto a curved surface or dome: http://i432.photobucket.com/albums/qq43/shwhjw/projection.png

The sliding method causes shadow flickering, with shadows flickering more and more as the visible portion moves further along the X axis (in camera space).

The rotation method causes the shadows to completely fudge up, and it's kinda hard to explain. They are never where they should be, unlike the sliding method where they just flicker in the correct place. The shadows move, disappear and distort as the camera moves around. Even rotating by 1 degree is enough to make a horrible dark stripe appear over part of the image. When no rotation is applied, the shadows are correct.

I was wondering if the shadows are computed using values in the camera's projection matrix? I know shadows have a lot to do with projection, but I thought only the light direction would come into it, not the camera projection?

I'm using deferred lighting as I want other types of lights to cast shadows too.

Does anybody have any ideas?

Thanks, Simon.

more ▼

asked Nov 22 '11 at 01:29 PM

shwhjw gravatar image

shwhjw
1 3 5 6

FYI it's a directional light I'm using at the moment.

Just tried it with forward rendering. It causes the rotation method's shadows to just flicker instead of distort and such.

Also there seems to be an area on the right side of the screen in which shadows are never rendered, which grows as the amount of rotation is increased. Like they're being sheared off.

Nov 22 '11 at 12:23 PM shwhjw

I think I'm going to have to use baked lightmaps...

Nov 22 '11 at 05:40 PM shwhjw
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3001
x170
x50
x46
x2

asked: Nov 22 '11 at 01:29 PM

Seen: 1181 times

Last Updated: Nov 22 '11 at 05:40 PM