Shadows with dynamic lights

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
nomad
Posts: 53
Joined: Thu Jan 05, 2006 12:35 pm
Location: Wales

Shadows with dynamic lights

Post 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.
AReichl
Posts: 268
Joined: Wed Jul 13, 2011 2:34 pm

Re: Shadows with dynamic lights

Post by AReichl »

just found this post (from 2006) by accident - is this meanwhile solved somehow?
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Shadows with dynamic lights

Post 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?
Post Reply