On any level with more than one or two meshes and/or some custom materials, Lightmass reports:
Couldn't gather the requested number of indirect photon paths! 0 gathered
and fails to bake any indirect lighting. I’ve tried numerous times to reset every possible lightmass settings, but I can’t find any reason behind this.
Furthermore, it appears to always work with built-in engine materials, and sometimes it works with any built-in engine material and one custom material, but will not work with one or two custom materials reliably.
To test this, I even created a stupidly simple level with two planes 300 units apart, facing each other, representing a floor and a ceiling. I placed a bright spotlight facing the floor. Additionally, I created a blank material with its base color set to white.
I should expect to see the spotlight reflected off the pure-white ground and onto the ceiling, back again, and so forth.
However, I don’t see that. I see nothing, because it gathers zero indirect photon paths, for some reason. If I revert all meshes back to their default
BasicShapeMaterial, it magically works again.
I’ve built lighting so many times over the past two days trying to figure this out before a deadline that I can’t remember if I had any successful lighting builds after updating to 4.20, but for the same levels this issue never occurred in 4.19.
- CPU: AMD Threadripper (in case this is an issue with Lightmass using Intel-specific instructions)
- UE4 is set up to use forward rendering and VR.
- These failures behave the same with or without using normals for static lighting option.
- Fails with or without material layers enabled. I had original thought that was the issue.
- All Lightmass options are default
- Fails with or without planar reflections
- Fails with or without high-quality reflections
- Fails with or without two-sided lighting/shadows
I cannot think of a reason for this. This is absurd.
Upon further investigation, it appears that even touching material layers permanently breaks static lighting builds on all levels.
Must you use forward rendering? It may work without it enabled. Though after updating to 4.2 I too cannot see any indirect bounces, even without forward rendering, it’s pretty annoying. Perhaps you must use stationary lights. Meanwhile, I suggest a sky light with shadows turned off
It’s a VR project, so forward rendering is highly preferred, if not required. Still, forward or deferred shouldn’t matter at all for static lighting, and I only mentioned it because it changes how shaders are compiled and could influence the material export process to Lightmass.
Try updating to 4.20.1, they addressed an issue with forward rendering, it might just work now. If it doesn’t, could you please post some screenshots? Mostly interested in Lighting only mode
I did update to 4.20.1, and no changes. I don’t think they even touched the code related to static lighting. Also, as far as screen shots, that’s kind of pointless. It’s the same as either setting the indirect bounces to 0, or using movable lights (but with the resolution of the lightmaps).
For anyone that runs into this issue -
Run a map check to see if you have any static mesh actors with null references.
Look through static meshes that might have broken material IDs - you will know it’s broken by opening the static mesh and looking at the material slots. If there is a white ‘X’ to the right of the material, it means there was, at one time, an element that referenced that material that no longer exists. Click the X to remove it.
Look for static meshes that have more overridden materials in the sublevel(s). This will show up during map check. Select the actor, ctrl+b to find it in the content browser, select it in the content browser. Inside the sublevel, right click the actor and choose to replace the actor with itself. This will reset the overridden materials. Then re-apply the materials.
Check for any static meshes that have strange behavior inside the sublevel. Delete it or replace it.
Re-bake lighting to see if photons are gathering.