Ground mesh renderer disappears if camera is too close

Updated on May 12, 2017 in [A] Brackeys Courses
Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on Reddit0
4 on May 10, 2017

Hello,

I’ve been following the “How to Make a Video Game in Unity” series and I finished it. I’ve gone ahead and added mobile controls to my game, and built the game on iOS + Android. For some reason, on iOS/Android, after a level is loaded, after about 2 seconds the ground fades out. I’ve done some testing and proved that this is the mesh renderer. I’ve also narrowed it down to the fact that the camera is causing the issue — it seems to be too close to the ground, or something? The weird thing is that this doesn’t happen on the Mac/Windows build.

Can anyone offer me any pointers as to what I can do to fix this? Thanks so much!!

  • Liked by
Reply
2 on May 11, 2017

It may be, that because your mobile devices probably have different screen sizes, the camera ends up form fitting to slightly different perspectives/distances. 

So what I would try first, is…
Select your camera in the scene, then, in the Inspector, set ‘near clipping’ to a very small value. Anything further away than this value should become rendered.

on May 11, 2017

My near clipping value is set to 0.3, far clipping is at 1000. I set near clipping to 0.01 to see if anything would change, and nothing did.

The especially weird thing is that on some iOS devices, it renders just fine. On my iPhone 7, it’s perfect. However, on a friend’s iPhone 6s (same screen size as the 7), the mesh renderer disappears. On Android, no matter what the screen size is, the mesh renderer disappears 100% of the time.

on May 12, 2017

I just went ahead and did some more testing. I have concluded that I don’t think it’s because the camera is too close to the ground — I changed its Y and Z values, and the same issue occurred. So, it seems that the ground is fading out/disappearing as the camera moves forward.

But that’s not all. It works perfectly (the ground doesn’t disappear/fade out) if I set the main camera’s “Rendering Path” to “Deferred”. However, this makes the game much choppier/laggier. So, this isn’t really a solution.

This is one of the most peculiar issues I’ve ever had to deal with in Unity…

Show more replies
  • Liked by
Reply
Cancel
0 on May 12, 2017

Alright, so I solved my own problem — the object causing the issue was the fog I had in the scene via the Lighting panel. It was set to “Exponential Squared”, and after setting it to “Exponential”, the game works perfectly!

  • Liked by
Reply
Cancel