Mobile Shadow Flickering

I’m getting strange shadow flickering behaviour in a specific device and i have been testing to tweak all parameters, still no win.

Stats:

Samsung Galaxy Tab 3

Camera:

  • Near Plane : 0.5
  • Far Plane : 28
  • FOV: 60
  • Occlusion Culling: True

Flashlight:

  • Spot
  • Realtime (I need for the flashlight effect)
  • Range: 30
  • Angle: 50
  • Hard Shadows
  • Low Resolution
  • Bias: 1
  • Normal Bias: 1
  • Shadow near plane: 1

Quality Settings:

  • Pixel Light Count: 1 (Added 1 point thanks to bart_the_13th answer)
  • Hard Shadows only
  • Low Resolution Shadows
  • Stable fit
  • Shadow Distance: 25
  • Shadow near plane: 1
  • No cascades

Player Settings:

  • Rendering path: Forward

Does anyone see anything strange in there? I’m getting a bit overwhelmed by all the things can be affecting it.

I want to win, guide me!

Could you not take a print screen or a video? It could be a number of things.

you need at least 1 pixel light for spotlight/flashlight to work

Added the 1 pixel light count. Nothing changed except that now i can change light render to auto instead of importat which i suppose they are related. Flashlight displays correctly.

But the shadow flickering is still there, i’m going to try to upload some kind of screenshot.

EDIT. Here are some screenshots :


There are not always the same, and not always showing. Maybe is rotation of camera related? Flashlight is a child of the camera to do the same rotation.

Ah forgot to mention i’m using Unity Personal Edition 5.3.4f1.

Have you made sure the normals are all correct on the object?

I suppose you talk about mesh normals? How do i check that?

I have the cube mesh filter and the mesh renderer as cast shadows off, receive shadows on. Light probes and reflection are off aswell.

If its just a cube within unity then the normal’s are probably not the issue. so the issue is only on the Samsung galaxy tab 3?

Yea walls are cubes (scaled up to 5) so i can make a little room. They have the cube mesh filter and nothing else special like a texture that is with a very basic shader:

Shader "BasicShader" {
    Properties {
      _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader {
      Tags { "RenderType" = "Opaque" }
      CGPROGRAM
      #pragma surface surf Lambert fullforwardshadows
      struct Input {
          float2 uv_MainTex;
      };
      sampler2D _MainTex;
      void surf (Input IN, inout SurfaceOutput o) {
          o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
      }
      ENDCG
    }
    Fallback "Mobile/VertexLit"
}

I tested it in samsung galaxy s4, s3 and Tab 3. Only Samsung Galaxy Tab 3 gets the flickering.

Are any cubes over lapping ? how thin are the cues? i think it might be z fighting in a weird way.
this is the only replication of the issue i can make and its z fighting.

https://gyazo.com/5b4b2068e43d63f014ce62fe6f4226fc

I’m gonna research about z fighting. They act as walls so they are cubes of scale (5, 5, 1).

EDIT: I researched about it seems it has to do with two objects being overlapped or something alike. Not my case :frowning:

Woah, i’m literally crying at a corner right now. I can’t get why in the freaking samsung galaxy tab 3 there is this shadow flickering. Do i should give up on it? :frowning: Been like 3 days trying 1 parameter at a time…

If it works on every other tablet accept the tab 3 then we can only assume its Samsung’s fault:

Try forcing opengl es 2

https://gyazo.com/2eea1e98b5a73299082062a92df2b45b

If this doesn’t do anything, try talking to unity’s graphics programmer Aras Pranckevičius, ill link him this post now actually.

Still nothing.

try any of these

  • reduce camera clip far (100 is good enough for game like this, lower will be better)
  • reduce shadow distance in quality setting
  • uncheck 24 bit buffer and check 32 bit buffer(if it’s unchecked) in build setting.

other than that, the only thing I can think of is to disable realtime shadow casting for the room it self (by baking the lightmap or unchecking receive shadow in the mesh renderer properties)

Tried near clip : 0.01 , 0.1, 0.4, 0.5, 1 and 5…
Tried far clip: 100, 50, 30, 10…
The shadow distance doesn’t help aswell tried 28 - 20 (and getting lower makes no sense at all for the game) and the 32 bit buffer is checked.

there is a option called Bias in the Light Component…try changing the value of that.

Played a lot with them aswell. In fact all parameters that appear in the first comment have been tested.

Well i discovered something, changing from spot light to point light solved the flickering without changing any other param. Isn’t this strange?

EDIT: I can confirm this is somehow caused by something not related with shadows. Cause i put them all off and i still get the flickering in the flashlight area.

Spot light is more complex than point and directional lights to compute, it has a modified fragment shader. It is pretty bizarre that it is only occurring on the tab 3 though unity would have to look into it but the tablet is a little bit dated now so its hardly worth it for them.

1 Like