views:

238

answers:

3

Hi All,

Was just wondering how I would go about creating a planar shadow from a 4x3 matrix, all online demos I've seen use 4x4 matrices instead.

+2  A: 

I guess that this is done by projecting a 3D object onto a plane, which essentially needs a fourth coordinate to represent infinity. If you only use 3 coordinates, you can only represent |R^3. However, for projections like shadows you will need full 3-space, thus including infinity - so you need the fourth coordinate.

I guess you can solve this with trigonometry and not matrices at all.

What is it you are trying to accomplish?

bayer
Just trying to make shadows in an environment where I don't have access to 4x4 matrices..
meds
+1  A: 

As noted in the other answer, you really need 4x4 to encode a projection.

If it's any help at all you can do directly overhead shadows by scaling your height axis to 0 and translating the squashed geometry to your ground plane. A bit rubbish, but might be something you could use. I used this once a few years ago on a project that actually wanted shadows like that.

Andy J Buchanan
A: 

Any reason you couldn't use a shadow map? To do a shadow map you render depth values from a light source. Then when rendering the normal image you translate the pixel to the light's space. If its depth is greater than the depth in the shadow map then its shadowed otherwise its not shadowed.

Wikipedia has a pretty good explanation. Lots more resources around the net. Google for "Shadow Mapping"

Goz
The platform I'm working on has very little memory and I'm pretty sure no way to render depth maps.
meds
Shadow volumes?
Goz