Android ESM glitches

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gammaker
:warning: Old Version Published before Godot 3 was released.

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.

:bust_in_silhouette: Reply From: gammaker

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);
    pass

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?