+2 votes

I wanted to create sharper shadows, so I increased ESM multiplier to 350. On PC it looks nice, but when I exported my project for Android, I saw terrible shadow glitches. They become weaker when I reduce this multiplier, but they exist even on value of 100, when shadows become very blurry.

I think that this problem is caused by mediump precision used in internal ESM fragment shader. Is there a workaround to get sharper shadows on Android without switching to PCF? Maybe I can enable highp precision on devices that support it?

My Godot version is 2.1.3.

in Engine by (32 points)
retagged by

1 Answer

0 votes

I attached this script to my light:

extends DirectionalLight
func _ready():
    if(OS.get_name() == "Android" || OS.get_name() == "iOS" || OS.get_name() == "HTML5"):
        set("shadow/esm_multiplier", 50);

So on PC shadows remain sharp as I like, but on mobile devices shadows become blurry and precision issues are almost not visible. But they can be seen if you take a closer look.

This solution works but it is not ideal. Many devices support highp precision, so they can do better. Is there a better solution in godot 2.1.3? And what about godot 3.0?

by (32 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.