Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS spot light / point light shadows not showing on device #39014

Closed
ViktorEvil opened this issue May 24, 2020 · 22 comments
Closed

iOS spot light / point light shadows not showing on device #39014

ViktorEvil opened this issue May 24, 2020 · 22 comments

Comments

@ViktorEvil
Copy link
Contributor

Screenshot

iPhone

Godot version:
3.2.1 standard and 3.2.2 beta 3 standard

OS/device including version:
iOS 13.5 iPhone 11

Issue description:
iOS spot light / point light shadows not showing on device

Steps to reproduce:
minimal project using cube meshes and a few lights and only shadows from direction lights are shown on device when running

Minimal reproduction project:
iOS Shadows.zip

@clayjohn
Copy link
Member

Is this in GLES2 or GLES3?

@ViktorEvil
Copy link
Contributor Author

Sorry it’s the same in both

@volzhs
Copy link
Contributor

volzhs commented May 24, 2020

seems similar to #24710

@ViktorEvil
Copy link
Contributor Author

ViktorEvil commented May 25, 2020

IMG_0582
Disabling vertex shading on mobile appears to fix the problem but may effect performance on slower mobiles. Also scene is a lot brighter than it should be

@fantomac
Copy link

Hello,
Someone find a solution to have for good 3d performances and shadows ijn iOS ??

@Calinou
Copy link
Member

Calinou commented Dec 29, 2020

Hello,
Someone find a solution to have for good 3d performances and shadows ijn iOS ??

Real-time lights will always be expensive on mobile devices, especially when shadows are enabled. If you want shadows on mobile, it's best to use baked lightmaps. The current lightmapper isn't great but there will be a new one in 3.2.4: #44628

Also, consider rendering the viewport at a lower resolution using the viewport stretch mode and setting a relatively low base resolution. This improves performance tremendeously and is often needed to achieve good 3D performance on mobile. See Multiple resolutions in the documentation for more information.

The optimization tutorials are worth reading if you want to know more optimization tips.

@ViktorEvil
Copy link
Contributor Author

This is still an issue on all versions of Godot up to 3.2.4 rc 2.

Are developers not supposed to use spot / point lights on mobile? If that is the case maybe we should have an option in the editor to be able to display how the game will look when exported to mobile. It’s very disappointing to set everything up in the editor only to have it look like garbage on high end mobiles

@Calinou
Copy link
Member

Calinou commented Feb 23, 2021

Are developers not supposed to use spot / point lights on mobile?

It's recommended to use baked lightmaps on mobile with the omni/spot lights' bake mode set to All (instead of the default Indirect). This way, you get the best possible performance and no issues with real-time shadows. On mobile (and even on desktop sometimes), a lot of the most popular games are still doing this for point lights in 2021.

If that is the case maybe we should have an option in the editor to be able to display how the game will look when exported to mobile. It’s very disappointing to set everything up in the editor only to have it look like garbage on high end mobiles

Unfortunately, there's no way to emulate all the rendering bugs that may occur on mobile on a desktop platform.

@ViktorEvil
Copy link
Contributor Author

Are developers not supposed to use spot / point lights on mobile?

It's recommended to use baked lightmaps on mobile with the omni/spot lights' bake mode set to All (instead of the default Indirect). This way, you get the best possible performance and no issues with real-time shadows. On mobile (and even on desktop sometimes), a lot of the most popular games are still doing this for point lights in 2021.

If that is the case maybe we should have an option in the editor to be able to display how the game will look when exported to mobile. It’s very disappointing to set everything up in the editor only to have it look like garbage on high end mobiles

Unfortunately, there's no way to emulate all the rendering bugs that may occur on mobile on a desktop platform.

I have done some digging into the settings for mobiles and think that some of the defaults should be disabled or at least documented in the settings a little better.

this is a prototype with settings unchanged, note how there is no specular.
image2

this has had “Force Vertex Shading.mobile” disabled it brings back the specular but is massively overblown
image1

this now displays the same as in the editor with nice smooth shading with specular highlights etc but I had to disable “Force Blinn Over Ggx.mobile” and “Force Lambert Over Burley.mobile”.
image3

I had to disable/enable settings one by one and export to my iPhone until I had found the correct settings. Somebody new to engine is not going to do that. They are going to export the game to mobile and see how it looks nothing like the scene in the editor then instantly dismiss the engine and switch to another one that has better defaults.

@Zireael07
Copy link
Contributor

Blinn and Lambert are enabled on mobile for performance reasons.

@ViktorEvil
Copy link
Contributor Author

Blinn and Lambert are enabled on mobile for performance reasons.

I understand that, but my argument still stands, there are lots of things that could be disabled for performance reasons.

A new user will still think that the engine looks like crap by default without lots of tinkering and move on to other things

@Calinou
Copy link
Member

Calinou commented Feb 25, 2021

I'm not sure if defaulting to settings that perform really poorly on mobile is a better thing to do...

Keep in mind that iOS devices are significantly faster than nearly all Android devices out there, for at least 3 reasons:

  • Faster CPUs and GPUs.
  • More optimized OS.
  • Lower resolution display, leading to less pixels to compute shaders for and less fill rate pressure.

However, defaulting to different graphics settings between iOS and Android is a can of worms as it will cause exported projects to behave differently depending on the target platform. It's good that your iOS device can deliver good performance on mobile with the high quality settings enabled, but this may not be true on a mid-range Android device released 3 years ago.

@clayjohn
Copy link
Member

The vertex lighting issue will probably be solved by #42543

@ViktorEvil
Copy link
Contributor Author

I'm not sure if defaulting to settings that perform really poorly on mobile is a better thing to do...

maybe you're right. I was incredibly frustrated and spent a very long time trying to get something running on my phone at a reasonable quality that I knew the device could run with ease. (I even downloaded Unity again)

I suspect that other iOS devs would have the same issue and just give up and move on which is a shame because the rest of the engine is very easy to use and is a joy to work in.

@ViktorEvil
Copy link
Contributor Author

The vertex lighting issue will probably be solved by #42543

Thanks :)

@fantomac
Copy link

Hello, for me I have a scene with dices rolled with dynamic shadows.
With your settings my iPhone 6+ is lagging.
I have to activate "Force Lambert Over Burley.mobile" and it's better.
Calinou is right.
With an iPhone 8 it's ok without "Force Lambert Over Burley.mobile".

@ViktorEvil
Copy link
Contributor Author

ViktorEvil commented Feb 25, 2021

Hello, for me I have a scene with dices rolled with dynamic shadows.
With your settings my iPhone 6+ is lagging.
I have to activate "Force Lambert Over Burley.mobile" and it's better.
Calinou is right.
With an iPhone 8 it's ok without "Force Lambert Over Burley.mobile".

IPhone 6+ is over 6 and a half years old, at some point I think it’s foolish to have settings enabled so that old tech still works, surely it’s better to have a good middle ground in the settings so that scenes actually resemble what’s in the editor. Instead we have settings enabled that try to run on everything and we are left disappointed when we export.

I would much prefer to export my project and actually see what I designed in the editor and then if it runs like crap on my hardware I know that I need to dial it down a bit. At the moment when we export it runs great but looks nothing like what is in the editor and we have no way of knowing if it’s a hardware or Godot limitation and what settings if any I need to toggle to get good visuals.

@clayjohn
Copy link
Member

clayjohn commented Aug 8, 2021

To summarize, there are 2 remaining problems here.

  1. Blinn is broken (both in Vertex and in Fragment lighting modes)
  2. Vertex lighting always uses Blinn

Fragment Blinn is fixed here: #51410
Vertex lighting still needs a fix (similar to #51410 but will involve more changes)

@clayjohn
Copy link
Member

When 3.4 releases can you re-enable force vertex shading and see if your problem has gone away?

@Calinou
Copy link
Member

Calinou commented Feb 28, 2022

@ViktorEvil Can you (or anyone else) still reproduce this bug in Godot 3.4.3 or any later release?

@Calinou Calinou added this to the 3.5 milestone Feb 28, 2022
@ViktorEvil
Copy link
Contributor Author

it looks fixed for me I have just re-enabled “Force Vertex Shading.mobile”, “Force Blinn Over Ggx.mobile” and “Force Lambert Over Burley.mobile” and I get a similar looking results

all mobile settings disabled
IMG_0221

all mobile settings enabled
IMG_0222

with the mobile settings enabled I use about 30MB less RAM but with slightly worse visuals, frame rate is roughly the same with only a 0.2 ms frame time difference

@clayjohn
Copy link
Member

Wonderful, thank you for following up!

Closing as fixed.

@Calinou Calinou modified the milestones: 3.5, 3.4 Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants