Download

Lightmass: incorrect indirect path driven photon emission for spot lights

Scene setup:
639f6b4f4e425e4daea581c5333612cdcafacbed.jpeg

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:
c029aa6995295b939ebdc356d105b95944773850.jpeg56781ec95e30c1787404f503062b92c0e63dfada.jpeg

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.

@DanielW

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! =)