Shadows with dynamic lights
Posted: Thu Jun 01, 2006 7:49 pm
Dynamic lights seem to cast shadows from the actual light position (as with point lights), not from the light angle as you would expect.
To fix this, in CShadowVolumeSceneNode.cpp, setMeshToRenderFrom() needs a small addition:
This just changes the light position during shadow volume creation.
To fix this, in CShadowVolumeSceneNode.cpp, setMeshToRenderFrom() needs a small addition:
Code: Select all
if (dl.CastShadows &&
fabs((lpos - parentpos).getLengthSQ()) <= (dl.Radius*dl.Radius*4.0f))
{
//needs a fix for directional lights
if (dl.Type==video::ELT_DIRECTIONAL) lpos *= -dl.Radius; //add