Spotlight lighting problem at distance

We are having an issue with lighting that I cannot find a setting to resolve.

This problem occurs on all assets in the level, but I’ve chosen the one that it is most apparent on, so please consider that before asking how this model and its texture is defined.

In the images you will see a lava texture from a range of distances. This texture has lower alpha in the orange/yellow areas that are being lit from below with a spotlight. Bloom is disabled, so the glow is just a result of the regular lighting.

The light that is creating this effect is a large spotlight placed below the level. I have adjuste the lights in the level to only have a spotlight while hunting down the source of this problem.

As we move the camera further away from the model a square lighting area seems to be surrounding the player with a maximum lit distance being applied. The lighting volume follows the player around, so we know this is not caused by some placed volume. In image 4 I have pointed at the cutoff location to be clear as to what we are seeing.

Moving the spotlight around changes the intensity of the light on the texture, but does not change the location of the cutoff area.

The lighting is also axis aligned (fig5). As the camera is rotated the edges of the cutoff move about as well.

As we move around the world with the free camera, this lighting also appears to be stepped. It does not smoothly follow the texture, but rather jumps to the next step instead.

Any idea how we can increase the distance that the light is rendered to?

Hey ,

I have a few questions so I can gather the information needed to test and verify this issue on my end. You mention this occurs on all your assets. When lighting a translucent object, the lighting information received is based on vertex count of the mesh. This means even if you tessellate your material, the lighting will still have a square look if your vertex count is low on your mesh. A couple of quick questions:

  • What is the vertex count of the plane/mesh you are using in the images provided?
  • What are your settings for the Spot Light actor illuminating the mesh from the underside?
  • More specifically, did you uncheck the ‘Use Inverse Square Falloff’ option?

Inverse Square Falloff

Take a look at this documentation which could have some helpful information on your issue as well. Also, as a quick note, since all lights are applied deferred in Unreal Engine 4, as opposed to the forward lighting path used in Unreal Engine 3, materials write out their attributes into the GBuffers, and lighting passes read in the per-pixel material properties and perform lighting with them. Therefore, having the lighting volume (assuming you are talking about lightmass importance volume) attached to the player will not have any visual effect on the lighting while playing.

Let me know if you have any other questions or need further assistance.

Thank you,

Hi Andrew,

I don’t know the vertex count, but looking at the scene in wireframe mode definitely points to that being the cause of the stepping by way of vertex lighting.

Spotlight properties below.

I did try with the inv.sq function off and, although the lighting is different, the cutoff was still in the same location.

I’m going to see if I can put together a 4.8.3 project in the next couple of days with just this problem occurring and will post it up here for reference, especially now that you’ve pointed out the vertex lighting issue, which hopefully should make it easy to reproduce.

Hi Andrew,

I have put together a very simple example of this problem in the 4.8.3 project attached. If you view from the camera I’ve placed in the scene and pan around at this height the problem should be clear. Also, moving up away from the plane the light disappears which is another issue we have due to a particular mechanic in our game that does this.

Thanks, Joshlink text

Hey ,

I took a look at the project you provided and found some areas in which you will want to edit. The first thing I noticed is you are using the Alpha channel for your opacity, which is normal, but your texture’s alpha channel is very white and almost empty. Hence plugging it into the opacity with a near completely white input makes it opaque and hard for light to pass through. Secondly, you’ll need to mark your material as Two-sided in the material properties so it can correctly receive light from both sides.

Lava Texture Alpha Channel

Red Channel as Opacity

I used your red channel to get a more pronounced opacity.

The third part of the issue is the scale in which you are attempting to apply the lights in relation to the scale of your mesh itself. If you want to illuminate a mesh that is 1000 times the scale of the original mesh, you are going to need more than a single light actor. Multiple lights of varying light types used in conjunction with a slight emissive material will produce some good results. This way, when you are at a distance, you will still see the lights fading out, but it will be much less visible as your emissive color will provide a strong visual assistance.

Here is what your set up looks like at a smaller iteration. If you are able to scale this application up then I am sure you can produce the results you are looking for.

Scene Set Up

The fading light you mention is the player camera fading out of the attenuation radius of the spot light actor. Typically, if you are using a light and setting its values to the Max and not getting the results you would like, it is best to scale it back. Add another light type or light source, and work within this new scope, changing your scene to help make your lights more pronounced.

Let me know if you have any other questions.

Cheers,

Hi Andrew,

Thanks for the reply. The alpha in that texture was just a way to show the problem, but it’s not core to the problem. I’ve created another example attached which has the texture opaque with a mesh that is large, but not scaled. In this one I’ve placed two spot lights. If you move the spotlights around the scene, you’ll see that the cutoff location stays constant.

Of interest, prior to linking the texture onto this object the lighting worked with just the basic mesh, so it appears to possibly be related to the fact that there is a texture/material attached?

link text

Further to the LightingTest2 sample, I’ve dug deeper and think I may have found the root cause of this. When I took my test texture off the object the lighting worked. I realised this is still using a UE default material and spent some time looking at the material we have.

It turns out that the Material Blend mode set to Transparent or Additive causes this issue. When set to Opaque or masked the lighting works as expected.

So now the question begs, is there a way around this?

Thanks, Josh

I would used the masked material as you can still set the overall opacity of your material by multiplying the alpha by a decimal between 0 and 1. Lit translucency has a maximum distance it will illuminate for performance reasons.

Is there any way to adjust the max distance? I can’t see how distance would be relevant to performance if the scene complexity remained constant.

The further the light needs to travel the more it needs to calculate, which in turn will eventually harm performance. As I mentioned, a way to hide the effect and have your lava illuminated at all times, would be to use the emissive channel in combination with your lights. This way when you reach the distance at which the light is no longer visible, the emissive property of your material has essentially masked the visual fade.

As another note, keep in mind you have no ambient fill light in your scene, so the fading light will also be more noticeable. Adding a skylight actor to your scene will definitely help reduce the fading light as well.

Thank you,

Thanks for the responses Andrew.

The assets I provided with this example are not the ones we are using in our game. I quickly threw them together because they were easy to use to represent the problem. In the lava texture from the original images, this is built from a fairly sophisticated material built from a set of dynamic components. We will obviously need to look into options to work around this limitation.

With respect to the performance issue, I would like some elaboration on this, as my understanding of this doesn’t match what you’ve stated, so maybe there is more going on that I’m unaware of.

If my screen resolution remains constant, and a pixel shader needs to sample the textures at a specific pixel location, whether that primitive is 10 units away or 10,000 units away should be of no consequence. The vector from a light illuminating that surface multiplied into that equation is similarly equal. It doesn’t matter if the light is 10 units or 10,000 units away. None of this math changes the number of samples that need to be taken for a given number of pixels on the screen.

I do understand that the quality will change with distance, as the amount of information packed into each unit of distance is diluted the further the distances are spaced, but that’s a visual issue, not a performance one.

Thanks, Josh

Hey ,

The lighting is based on the vertices of your mesh and not the pixels when using a transparent material. In turn, if you are using a large mesh, like your plane, that is tessellated to have accurate lighting. The light emitting in the distance will still be attempting to accurately light the vertices in the distance.

Your information is correct in regards to per pixel shading, but this equation does not apply and scale the same as vertex lighting. I did find a solution which you might be able to apply to this specific set up.

Light Functions

With a light function you can set the Light function fade distance property, which seems to be what you are looking for in regards to your own project.

Cheers,