Lightmass: incorrect indirect path driven photon emission for spot lights

Scene setup:

Results of 2 bounces and 100 bounces of light. Note that the right wall is much brighter than it should be, when compared to the left wall and the floor:

And the correct results are: (rendered with Mitsuba renderer)

After investigation, I found that if I turn off indirect path driven photon emission in Engine\Source\Programs\UnrealLightmass\Private\Lighting\PhotonMapping.cpp: EmitIndirectPhotonsWorkRange(): 898, but always sample the lights uniformly, the problem will be gone:

Further investigation shows that FLight::SampleDirection using IndirectPathRays is overloaded for FDirectionalLight and FPointLight, but not for FSpotLight. Then because FSpotLight is derived from FPointLight, when SampleDirection is called on a spot light it falls back to FPointLight::SampleDirection, which does not take the cutoff angle of the spot light into account.


That’s extremely interesting, thanks for finding that and sharing your results with me! I plan to follow up on this and fix it, unfortunately I am swamped at the moment so I’ll have to add it to my list.

Thanks Yujiang! =)