Page 1 of 1

Shadows with dynamic lights

Posted: Thu Jun 01, 2006 7:49 pm
by nomad
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:

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

This just changes the light position during shadow volume creation.

Re: Shadows with dynamic lights

Posted: Wed Oct 28, 2015 9:02 am
by AReichl
just found this post (from 2006) by accident - is this meanwhile solved somehow?

Re: Shadows with dynamic lights

Posted: Tue Nov 03, 2015 6:21 am
by chronologicaldot
No, unfortunately.
These lines are now 286 - 291 of updateShadowVolumes() in the same file.
Anyone want to do a quick test to see if it works so cutealien doesn't have to?