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.
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.
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?
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.
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"