Combination of TiledLighting and LightChannel settings may cause an issue

This issue occurs in vanilla UE4.12.5, as well.

When placing a SpotLight with the LightChannel setting being modified and an object that could be affected by the channel, and then executing TiledLighting, the light affects even another object with no relevant LightChannel.

In the above image, the SpotLight has been set so that it only affects the ball. (The ball, however, is not lighted because it’s placed outside the range of the SpotLight.)

For the SpotLight, the “Cast Shadow” box is checked off. With that, I switch to TiledDeferred, using the following command:

r.TiledDeferredShading.MinimumCount 0

Then, the object with no relevant LightChannel is affected by the light as shown above.

Also, if clipping the ball out of the screen, the light will no longer affect the object.

I would like to provide [a sample project][4] that can be run in standard UE4.12.5. You can confirm the issue on the editor without having to play it.

I’d appreciate it if you could confirm this.

Thanks.

Hi Masahiro, thanks for reporting this issue.

Currently lighting channels are not supported with tiled lighting.

It may be possible to add that feature yourselves if you’re happy working with rendering code and shaders. The main implementation for tiled lighting is in TiledDeferredLightShaders.usf, and the CPP implementation for that is in TiledDeferredLightRendering.cpp.

The implementation for lighting channels for non-tiled lights is in DeferredLightPixelShaders.usf. The important code is this:

#if USE_LIGHTING_CHANNELS
		&& (GetLightingChannelMask(InUV) & DeferredLightUniforms.LightingChannelMask) 
#endif

The GetLightingChannelMask function reads from the Texture2D LightingChannelsTexture. You would need to pass that in, and importantly you’d need to pass in the LightingChannelMask as part of the per-light data which is passed into the TiledDeferred uniformbuffer.

Hi Masahiro,
Just to let you know, we have added a bug for this with ID UE-34687. We will update this thread when we have further information.

Please let us know if you get a chance to tackle this before we do.