Materials turns weird in Android

Hi
I started working on a project with Unity 3.5 for Android and IOS. When I updated the project to 4.0 and even now with the 4.2.1 version I get a weird behaviour with the materials or I don’t know if is a problem with the shaders. It’s hard to explain and it is also hard to google it so I take a screen shot of the problem.


image 1

image2

This is a corner inside a room but the problem is in the whole level. In the first image I have the corner as it suppose to be and the second one has the problem. It changes depending on the camara position. If it is far from the object, it even turns transparent

By the way, this problem occurs in the Android version but not in IOS

What can it be?

thank you in advance

I’m haveing the same problema and I posted this yesterday: http://forum.unity3d.com/threads/199792-Problem-with-graphics-on-Android-(Opengl)

But nobody seems to know what’s happening. I found this problem happening to people since 2011.

I’m delaying the release of my latest game because of this problem.

This is a very serious issue and the Unity team should check this out.

:rage:

Andre Lima - maliceinteractive.com

Which shader are you using? Post an example project for us to look at.

I tried difuse since I wanted to set a color, then a tried mobile difuse with a solid color image. I’ll try to make and example project with the error
Thank you

This is weird.

I created a new project and the problem, normally present in the GAME VIEW and on the device, now appears on the SCENE VIEW, and no longer on the device.

LUCKILY… I fixed it in my main project by raising the Main Camera Clipping Planes/Near value up to 30. This may cause some problem depending on the scale of your game, but may work well with lower values too.

Worth a try.

The important thing about near/far clipping planes is that they drive the depth resolution of the z-buffer.

A pixel is drawn at distance D. There is a near plane at N, and a far plane at F.

  • If D is less than N, it’s not visible.

  • If D is greater than F, it’s not visible.

Most people understand this pretty quickly.

  • Next, the value D has to be rounded to the nearest possible value that the Z buffer can hold.

  • If F is too huge, or N is too small, then the values the Z buffer can hold are very far apart in depth.

The setting of N is much more sensitive, as it’s a divisor: changing 1.0 to 0.5 will double the thickness of those Z buffer depth slices. Changing it to 0.25 will double it again.

You want the “near” plane to be as big as possible without letting the camera mash into the scenery.

You want the “far” plane to be as close as possible without clipping geometry that MUST be visible.

Thanks Halley,

Great tips.

The weird thing is that this problem only happens in the Android platform.

Likely the zbuffer has fewer bits of resolution on the device(s) you tried, so it shows the problem much more aggressively. If you drop from 32bit to 16bit, that means each z slice could be as much as 65000 times thicker!

Thank you very much, I didn’t know that. I have to make some change to my game because I had considered a near plane of 0.3 but at least the main problem is solved.
Really Thank you