- Home /
[Closed] Material Properties Not Applied To glProgram at Runtime
Hi All,
We recently encountered a rare and random rendering issue with Unity 4.2.0 on Android devices.
We have a dressing room scene, where the player can try out various outfits for their avatar. When a different piece of clothing is put on, we change the mesh and material for that body part. The problem we are experiencing is, by a small random chance, the material of the new clothing will render incorrectly. The type of the visual artifacts is also random. Possible results includes: pure black, black diffuse color with correct spectacular lighting, or completely invisible.
We did investigate deeper into the details of the problem. ARM arms us with a powerful debugging tool for systems with a Mali GPU - the Mali Graphics Debugger. It works just like PIX on D3D platforms - at a given time, by intercepting all graphics API calls issued from target application, it captures a complete snapshot of the graphics pipeline. That's how we found the cause of the above mentioned issue.
Here are the values of some of the uniforms (and texture samplers) when Unity draws a mesh with completely black diffuse color:
The uniform with the name "DiffuseColorFactorC1" (which is one the material properties) is used by the current glProgram without a correctly set value. As we performed more tests, it turned out that other uniforms and even the texture samplers may be null. All of the cases happened occasionally and we could not find a 100% repro.
So this is almost certainly a bug of Unity itself. I contacted a Unity Developer I know in person, and he confirmed they already received similar bug reports.
I want to know if anyone here at the Unity Community has experienced similar issues, and whether you have figured out a workaround. We just can't wait for a new Unity release.
[UPDATE] Reverting back to Unity 4.1.2 fixed the issue. We'll check out Unity 4.3 when we have time.
Your answer
![](https://koobas.hobune.stream/wayback/20220613121405im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
QuickOutline: how can I change the shader to work with objects with two materials? 3 Answers
See through issue in iOs 0 Answers
Texture alpha doesn't scroll with offset 1 Answer
z-fighting problem with shaders 2 Answers
Render a object on top of another. 2 Answers