Font shadow rendering issues

I get large blocks of black on some glyphs (some are fine) on an iPhone 5C. It works on all other devices I’ve tested on.

It’s a distance field font. When shadow is disabled or when using bitmap as output format it displays correctly.

Is there something I can do to fix this and keep it as a distance field (the best invention since the beginning of time)?

Can you share this in a minimal project please?

Of course!

Local player:

On device (iPhone 5C):

Minimal project:
Font Artifacts.zip (211.6 KB)

Font Artifacts.zip (3.1 KB)

Can you try this one on your phone? I disabled the mipmaps on the font material.

That’s a quick response! Same result, I’m afraid.

Can you post a screenshot of the device display after changing the VP and FP to the standard font ones?

Playing around with settings I stumbled on something interesting: When changing Shadow Blur from 0 to 1, the issue disappears. This is an acceptable workaround for now, and may lead to clues as to why it’s happening in the first place.

1 Like

:thinking:

That does look correct, maybe something in the DF Fragment Program is breaking on your device, could be a shader error. As you mention, it could be related to how the shadow is handled in the FP.

So the next step is to make a copy of the font-dp.fp, enable the copy, and try to mess with the code lines related to the shadow to see what breaks. :slight_smile:

Of course if the blur 1 works for you may not be worth spending more time on this, at least if it comes up in the future again there will be this insight.

1 Like

@totebo Make a copy of the shader and try changing from mediump to highp:

mediump vec4 sample = texture2D(texture_sampler, var_texcoord0);
mediump float distance = sample.x;
mediump float distance_shadow = sample.z; (edited)
2 Likes

Changing the shadow related vars from mediump to highp didn’t seem to have any effect, so I went in and changed ALL of the vars to highp, both in font-df.fp and font-df.vp. Still showing the same way, I’m afraid.

Double checking: you made sure to use the new material with a modified shader on the font? (it’s a simple mistake to make)

Ha ha ha yes, I have made that mistake too many times. I double checked I had repointed the material to the custom ones too.