Standard shader material directional light reflection creates big white artefacts on iOS

I’m trying to create a glass material. The way I configured it is the following:

Shader: Standard shader (specular)
Rendering Mode: Transparent
Albedo: black color with 90 in alpha
Specular: very dark grey with a value of 35
Smoothness: 1

I’m getting something like this on iOS for a nearly flat surface:
2092277--136857--ReflectionWhiteArtefacts.png
In the editor it shows up as a white pixel at the same average position. The white dot is due to the directional light reflecting off the surface. This dot becomes a blurred disc when you lower the Smoothness value. On iOS a lower value produce the same sort of artefacts even if those are less visible. I first used that as a workaround but it doesn’t produce the best effect.

Is there a way to prevent this reflection dot/spot/disc from happening?

I have actually got the same result with a non-transparent material some times ago. It seems to be happening every time I use standard shader, but is most visible in the case smoothness is set to 1.

By the way I’m using Unity 5.0.1, OpenGL in the editor as I’m on Mac OS and OpenGL ES 3 on the targetted device.

1 Like

I’m surprised no one had the same issue…

Without modifying unity lighting pretty much no.
It’s because the sun is treated like a infinitely small light source for specular reflections, this resulting in a dotty reflection. (And often very flickery).
One way around this is to treat directional lights as a non-point source.
Another is to clamp glossiness for the BRDF. (While still letting the ambient specular go to perfect sharpness).

My guess is that most developers/artists simply avoid using so high smoothness values.

Thank you for your response and sorry for the late reaction. I’m aware most surfaces don’t have such smoothness, at least far fewer than we think. In my case though, glass seems to me to be a good candidate. Anyway, I’m not really an expert in shaders… maybe could you give some more directions on how to tinker with BRDF… I’m pretty sure you already have posted some stuffs about that but I can’t put a hand on it right now. I suppose I need to create my own shader from the standard one and modify some parts… I’m not sure on how to do it correctly, I’ll dig deeper in the forum though! Thanks.

Oh and I forgot the essential: are you telling me the result I get, shown in the picture above, is to be considered normal? Again this is the result I get on iOS. In the editor it’s perfectly smooth, a pixel in the case of smoothness = 1, a smooth disc below… which is perfectly fine. It gives quite similar results (though a little different) until I go below the 0.4 in smoothness (where actually the disc gets totally blurred out in editor).

Umm ok, then no, this is NOT correct!
I’d have expected this to happen in the .95-1 range…

To be more complete I’ve just made a screenshot with other values:

The setup is simple: a directional light, 5 quads, each having its own material applied with the standard shader (specular setup) (same as above actually) with the indicated smoothness value. Choosing opaque, transparent, changing to standard shader has no influence.

Umm, what comes to mind for me is how your normalmaps look?
As the size of the highlights isn’t that far off. Feels to me more like a broken/bad normalmap.

Absolutely no normal is used for those tests… even in the real scene. I would be curious to try on another device… but I’ve only one here.

I have been getting this same result on all light types on iOS, normal map or not.

I’ve submitted that behavior as a bug with Case 697530.

No news on the subject from Unity. I had sent a bug report and I will certainly redo some test with last version to confirm it’s still an issue. I “worked around” the problem by lowering the smoothness but never managed to get rid of it :cry: What happened for you @echo4papa ?

I avoid lights as much as possible, honestly. A single directional light and then let the ambient IBL do it’s thing.

That’s actually what I’m doing but as the directional light is actually the source of those artefacts for me…

Just to make this more current again: I am facing exactly the same issues here, so there hasn’t been a fix yet, i believe? Running Unity 5.5, Metal deferred/linear rendering

The same thing appear for us :
Unity 5.4.4, standard shader on a flat surface, no bump just an albedo map and smoothness to 1 (metallic to 0)
when we try to do glass or chrome
Any idea of what’s happen ?

Same issue on Mobile (Andoird and iOS). Simple scene with a cam, a Directional Light, and a plane with Standard Specular Shader: Specular set to white, and smoothness at 0.9.

No luck so far.

1 Like

Same issues here on new mobile iPhone X with iOS 11.2. The directional light blob has really weird artifact with standard specular shader with high smoothness value on flat surface. Any ETA on fixing this from Unity?

2 Likes

We’re having the same problem. Any help / workaround would be gratly appreciated.

1 Like

We’ve found a solution by forcing float instead of min16float in HLSLSupport.cginc.

Replace:

#if defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || (defined(SHADER_API_MOBILE) && defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))
// GLES3 and later via HLSLcc, use DX11.1 partial precision for translation
// we specifically define fixed to be float16 (same as half) as all new GPUs seems to agree on float16 being minimal precision float
#define fixed min16float
#define fixed2 min16float2
#define fixed3 min16float3
#define fixed4 min16float4
#define fixed4x4 min16float4x4
#define fixed3x3 min16float3x3
#define fixed2x2 min16float2x2
#define half min16float
#define half2 min16float2
#define half3 min16float3
#define half4 min16float4
#define half2x2 min16float2x2
#define half3x3 min16float3x3
#define half4x4 min16float4x4
#endif // defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || (defined(SHADER_API_MOBILE) && defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))

With:

#if defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || (defined(SHADER_API_MOBILE) && defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))
// GLES3 and later via HLSLcc, use DX11.1 partial precision for translation
// we specifically define fixed to be float16 (same as half) as all new GPUs seems to agree on float16 being minimal precision float
#define fixed float
#define fixed2 float2
#define fixed3 float3
#define fixed4 float4
#define fixed4x4 float4x4
#define fixed3x3 float3x3
#define fixed2x2 float2x2
#define half float
#define half2 float2
#define half3 float3
#define half4 float4
#define half2x2 float2x2
#define half3x3 float3x3
#define half4x4 float4x4
#endif // defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN) || (defined(SHADER_API_MOBILE) && defined(SHADER_API_METAL) && defined(UNITY_COMPILER_HLSLCC))

This is done using Unity 2017.3.1f1

5 Likes