Lighting on Mobile issues (4.10)

I’m having a devil of a time getting my lighting to work on 4.10. On my Galaxy S4, the lighting is always shadeless. It seems as if only the ambient world lighting is working. On my nVidia Shield there is NO lighting at all. Whatever isn’t glowing is completely invisible. I’ve been experimenting with Static, Stationary, and Moving lights. So far the Moving lights seem to have the best impact, but only a few of them seem to show up, and the rest are apparently missing. Rebuilding lights does nothing.

Important note: My game is all procedurally created, so there isn’t really anything in the level before the game starts.

And yes, I do have a Lighting Importance Volume. I made it HUGE just so there’s no way the level is outside of it.

When I test this all on the PC, everything works as it should.

HI MaxSMoke,

While Dynamic Lighting is supported on mobile, with it’s own limitations, dynamic shadowing is another issue. On the Directional Light you can set Cast Modulated Shadows enabled that will work for dynamic/movable objects, but the rest of the scene should use static lighting. With Point and Spot Lights you can have up to 4 dynamic lights, but these do not cast dynamic shadows. The number of dynamic point lights can be changed in the Project Settings under Rendering.

Important note: My game is all procedurally created, so there isn’t really anything in the level before the game starts.
And yes, I do have a Lighting Importance Volume. I made it HUGE just so there’s no way the level is outside of it.

Light baking and Lightmass Importance Volumes do not work procedurally. These require the lighting to be built before hand. It’s the nature of using pre-computed lighting.

When I test this all on the PC, everything works as it should.

When developing for mobile on a PC and you want to see what it’ll look like, within some degree of reason, you can use switch the viewport render mode. You can do this by going to Settings in the toolbar > Preview Rendering Level > Mobile > Choose the best option that fits your needs.

This preview mode will adjust the features that work for most devices in that category. There is the possibility that it will still render some things that will not look like on the device, but it’s a closer option than the default render with all the features turned on.

I hope this helps.

Tim

OMG… when I changed that setting it started compiling over 6000 shaders. My computer stalled out for an hour. Wish you would have mentioned that before I selected that option. My “quick test” of your suggestion has put ridiculous stress on my computer, and I still have to change it back because this project is for the PC as well.

I have shadows turned off on everything but the spotlight that’s attached to the front of my tank and the “Light Source”. Light Source gets me shadows and functional lighting. Point Lights don’t show up unless they are set to Movable. The Shadow setting does nothing to change this, Point Lights just don’t work in Static or Stationary. The Spotlight doesn’t work at all.

Of course, this is only true on the Galaxy S4. On the nVidia Shield Portable, there is no lighting of any kind. Only glowing objects are visible. The Widget based HUD is unaffected, of course.

My older projects didn’t have this lighting issue, using 4.7, 4.8, or 4.9. This is just a recent development. I believe it’s a bug that needs to be addressed.

Sorry about the shader recompilation. It’s not something I do often so I tend to forget about it, and on our machines here it doesn’t usually take more than 5 minutes or so to recompile all the shaders.

If you’re game is Procedurally generated static and stationary lights will not work for your intended purposes. Static/Stationary Lights require that lighting be built.

Dynamic Point lights are now supported up to 4 but no shadow support yet. Spot lights are not yet supported dynamically.

I’ve not seen the same results on my end using the NV tablet or the Samsung Galaxy 3 (my personal phone) that I have to directly test on. Even on my low-end phone I can see all the lights working as intended. On the NV Tablet everything is checking out as well with no difference other than slightly better visual quality.

Here is my sample Project. Just load the MobileLightTest.umap to see. You can package this for your device as a test for comparison.

I’ve setup multiple lights and mobilities that all the lights.

  • Dynamic Point Light
  • Static Point Light
  • Dynamic Spot Light
  • Static Point Light
  • Dynamic Directional Light

This should give us a baseline with something that works on my end, vs your test devices.

Ok, I just downloaded it, open the level, compiled a package…

This is interesting, part of the level isn’t there on the nVidia Shield. Keep in mind, this the first generation Shield, not the Tablet. Everything around “Dynamic Point Light” is missing (just text), and everything but the column is missing around “Static Point Light”. I can see the render text in the missing areas. All of the other items show up as they should, although there is some pop-in around the bottom. It’s like it’s doing some kind of weird clipping… which might be the cause of my issues. (hard to say, still testing)

(on the Galaxy 4, everything appears as it should)

I notice you had an Atmospheric Fog, which I don’t have, as well as a Sky Sphere. I’m not too sure if those are critical or not, but I’m adding them.

Update: Adding the fogging did nothing. The Shield still shows no models, only render text and billboards. Sometimes I see a model silhouetted by a billboard (I use them for cheap glow effects). Some of the models look fine, and others appear to be turned inside out. I only see this for an instance, and most of the models don’t seem to silhouette. Again I’m getting hints of a geometry issue…

Is it possible the Unreal Engine no longer supports the first generation nVidia Shields? I don’t think those units are that old, so it would seem weird to drop support of them. All of my older games seem to work just fine, all the way up to 4.9.

I’ll see if anyone has a NVidia Shield Portable that I can test on. It may be next week or when everyone gets back from their holiday break before I can test this, but I’ll see if I can see the same on that device, if we have one available, which I think we should.

When I made the level I just used the default scene so there was no specific reason for the atmospheric fog or sky sphere other than I knew they would package without issue on the devices that I have.

Once I’m able to find out about the device I’ll post back here with my results. If you stumble across anything extra feel free to post and I’ll check it out.

Thank you!

Thanks, I definitely will! I’d really like to get my game running on the Shield Portable as it’s an ideal device, good controls, not alot of other game producers in that segment, an established marketplace. Selling games in the normal android market is nearly impossible these days without some big advertising support.

Here’s a link to the beta, which runs great on my S4, but produces black weirdness on the Shield:

http://worldwidechaosinc.com/MazeTest1-armv7-es2.apk

I’d love to know if it runs on the Shield Tablet, if you get a chance. I suspect, at this point, it probably runs fine on all new nVidia devices, and mine is just a tiny bit too dated.

Hey Max, sorry for the delay here.

I was able to get a Nvidia Shield to test on and it appears from what I found that when using dynamic point lights will cause this issue. I’ve reported it with UE-25671.

I will update here once this has been resolved.

That is awesome! You have no idea how wonderful it would be to have my game in a portable form with good controls. I’ve tried to use the Xbox gamepad with a USB connector to my Android phone, but the thumbstick and trigger buttons are all mixed up. The Shield, on the other hand, has perfect controls (from what I can see), but no graphics at all.

So, did you find the problem? I’m still hoping the portable Shield can be made to work with Unreal. My game is getting close to it’s first releasable beta, and I’d like to aim it towards the Shield.

The bug is marked as “To Do” with a fix version currently marked as 4.12, but that does not guarantee the issue will be investigated. It’s just on the to-do list for the moment. Once a fix has been submitted I’ll update, but at the moment there is no other information I have to provide. Sorry for the inconvience.

Heard anything about a bug fix? I’m still love to get it on the Shield.

No change. Still set for a target fix with 4.12, but that can always be pushed depending on other priorities that come up.

Have same problem with spot light on android… working on PC , but not on my phone, hope they will fix this bug …

@Abuzhis

That would be a different issue. Dynamic Spot Lights are not supported for Mobile at the moment. Only Dynamic Point lights and Directional Lights, and the Point Lights do not shadow cast.

Hi Tim, firstly I wanted to thank you for uploading this super helpful project! This really assists me to understand what kind of shadowing works on mobile.

However, I was wondering if you could clarify a few things, using the “mobilelight” project you uploaded above:

  1. With Mobile HDR disabled in the project settings, and the lighting built on production quality, the directional light which was set to “Movable” shows shadows from both the moving and static object, however it does NOT show the red modulated shadow color, either in the editor’s viewport when set to Android preview, or in the Mobile Preview (PIE).

  2. When the same directional light is set to “Static” (and lighting is built), only the static cylinder casts shadows and the moving one does not, in both the viewport and Mobile PIE.

  3. Additionally, when the same directional light is set to “Stationary” (and lighting is built), the red shadow finally shows in the editor’s viewport, but ONLY from the movable cylinder, not the static one. However, in the Mobile PIE, no red shadow is shown on the moving cylinder, but a black shadow shows on the static one.

  4. The “Shader Complexity” viewmode (shortcut ALT-8) in the Editor shows bright red for everything, while the “Shader Complexity” viewmode (shortcut F5) shows a dark maroon, as if the scene is actually quite good.

  5. Lastly, the default preview mode of the Mobile Preview (PIE), which should be “Lit” (shortcut F3), looks extremely blown-out compared to the Editor’s viewport “Lit” mode (when set to Android preview). In fact, the PIE’s “Lit” mode, looks nearly identical to the Editor’s “Light Complexity” viewmode (shortcut ALT+7). (I actually thought “Light Complexity” was supposed to show a green to red rendering of everything.)

Is all this behavior normal?

Thanks so much for your assistance!

Sincerely,
Adam Janz

@AJ_Graphix

1. Modulated shadows don’t work without Mobile HDR.

Mobile HDR needs to be enabled for modulated shadowing to work and also requires a stationary directional light. It will not work with other mobilities.

2. When the same directional light is set to “Static” (and lighting is built), only the static cylinder casts shadows and the moving one does not, in both the viewport and Mobile PIE

This is 100% expected behavior when using static lighting. Shadows cannot be cast since only precomputed lighting has been used.

3. Modulated Shadows works for movable but not static actors. However, in the Mobile PIE, no red shadow is shown on the moving cylinder, but a black shadow shows on the static one.

Modulated Shadows are only expected to work for movable actors. It’s a cheaper dynamic shadowing method that was added a while back to get dynamic shadowing for movable actors. With some of the newer phones and chipsets releasing it’s getting closer to a possibility of implementing more dynamic shadowing options for mobile, as can be seen over the last couple of releases, like CSM shadows for Stationary Directional Light on mobile.

Looking at my test map, the black shadows for the dynamic light is expected because dynamic lights do not produce any bounce light (Global Illumination).

4. The “Shader Complexity” viewmode (shortcut ALT-8) in the Editor shows bright red for everything, while the “Shader Complexity” viewmode (shortcut F5) shows a dark maroon,

Shader complexity can be a good metric but it should be more a guideline and not taken as the strict truth of how well your shaders are performing. Also keep in mind the differences between PIE and Editor could be something as simple as a toggle has been turned off for some specific post process or option under the viewport > Show flags.

continued next post…

@AJ_Graphix

5. viewmodes light complexity

With mobile you lose a lot of features, like some post processing. This is expected as well and may not fully represent what’s on the device depending on its features and what is supported. Mobile HDR plays a big role in this too. Not all devices support it and even if enabled in the editor will not work on the device. Test on your device and test often for the best representation of how the scene will look.

Thank you so much, Tim, for taking the time to reply! This info really helps.

In regards to your answer to question 1, if Mobile HDR must be enabled for modulated shadows to work, what type of shadow is being displayed then?

If developing a game to target a wide range of devices, would it be safe to enable Mobile HDR (and manually disable all post-process features) to receive the performance benefits of modulated shadows, or should one reject Mobile HDR and modulated shadows altogether in favor of some other method?

I really appreciate your advice on this. Just trying to make sense of all the caveats of mobile to avoid making major design mistakes early in the process.

Thanks again!

~Adam

I should also mention that when Mobile HDR is enabled, the PIE and Editor views match (PIE is not blown out). Also the 2 shader complexity views also match {ie. both are bright red, rather than the PIE as maroon (less expensive) and the Editor as bright red (very expensive)}. So I guess the blown out look in PIE (when Mobile HDR is off) is normal and expected?

Thanks.