Repository navigation
Description
Description
The relevant THREE github issue on this case: mrdoob/three.js#14137. It was opened more than year ago and there is still no solution. Model-view player based on the same THREE.js library, but it does not work on a lot of popular devices. For example, many Xiaomi phones (even flagman ones) can't work with it. Tested on Redmi 4A (Adreno 308), Mi A1 (Adreno 506), Mi6 (Adreno 540). More devices with black textures issue can be found by the link above.
Errors in the console:
- WEBGL_depth-texture extension not supported
- OES_texture_float_linear extension not supported
- EXT_shader_texture_lod extension not supported.
Screenshot of our own test , but can also be produced on the main page with astronaut.

Browser Affected
- Chrome
- Firefox
I guess all available for Android platform browsers are affected.
OS
- Android
Additional information
- The problem is in MeshStandartMaterial (https://threejs.org/docs/#api/en/materials/MeshStandardMaterial). We use difuse, normal, metallic and roughness maps with this shader and get black texture problem in our own project with THREE.js too. I think the astronaut in model-viewer inherits the same issue.
- From the documenation about MeshStandartMaterial we can get that it's about "physically based rendering (PBR) has recently become the standard in many 3D applications, such as Unity, Unreal and 3D Studio Max.". Ok, I'm Unity developer, so let's do the test.
- Open Unity 2019.1
- Create project with LightWeightPipeline
- Choose shader for material object similiar to THREE's MeshStandartMaterial. I'll attach the screenshots from Unity and THREE editor. Shaders parametres are very similiar.
- Make a build
- That's it, rendering is fine!
So, I supppose the phones are OK with PBR and can handle diffuse/normal/metallic/rougness shader. THREE's developers think that there is nothing they can do.
I hope google engineers can handle this issue together with THREE developers, because Web AR really depends on it.


Activity
cdata commentedon Jul 30, 2019
@AytoMaximo thanks for reporting. I only glanced at the upstream Three.js issue, but it sounds like they decided that this is a WebGL / vendor-specific issue?
Are you seeing this problem on all devices, or on a specific Android device?
AytoMaximo commentedon Jul 31, 2019
@cdata I've tested on Xiaomi devices, all of them have this issue.
Also, you can get a big list of devices from the mrdoob/three.js#14137 thread:
They can't decide that it is a WebGL issue 'cas from the first post we see the following:
"This doesn't appear to be a problem with all WebGL texturing, though -- https://fltr.world/ (simple texture demo implemented with three.js shaders) works fine, as does https://webglsamples.org/aquarium/aquarium.html "(c).
The first link is unreachable, however the aquarium is really fine.
Also, that's why it is not vendor-specific issue, because aquarium is fine, and my example with Unity is fine.
I also posted the same issue on Chromium bug tracker, they asked me produce a minimal test case that shows that there is a problem with handling of a valid shader on this phone. And suggested these links: https://github.com/KhronosGroup/WebGL , in particular the tests under https://github.com/KhronosGroup/WebGL/tree/master/sdk/tests/conformance/glsl/misc , can be used as a template.
But I'm not shader developer and don't understand what is going on there :(
It seems like guys really need some help, because they struggle this issue for a year or longer with no results. Moreover, I think the list of devices is very big and it's not over yet, so developing Google AR view with THREE.js library inherits a serious bug.
paluh commentedon Aug 20, 2019
I was able to "fix" rendering on my "Moto G4" by passing
precision: 'lowp'here: https://github.com/GoogleWebComponents/model-viewer/blob/6eb788f5417ca34155c282199cb92f63cae3507a/src/three-components/Renderer.ts#L75This is suggested as a workaround in this thread:
mrdoob/three.js#14137
Of course hardcoding this value doesn't seem like a good solution to the problem.
paluh commentedon Aug 20, 2019
I'm not sure if my previous post adds any value to the discussion as @AytoMaximo is aware of this workaround as an active participant of the pointed (in my comment) threejs issue thread. @AytoMaximo should I delete the above workaround suggestion?
elalish commentedon Aug 26, 2019
Would you be so kind as to upgrade to our just released 0.6 version and repro? We did a bunch of work in this release to address device-specific rendering issues and I'm hoping this is solved, but I don't have access to enough test devices here to be certain.
AytoMaximo commentedon Sep 3, 2019
@elalish, sorry for the late answer, had plenty of work to do :)

Unfortunately, now it's black everywhere. On my Windows PC (Chrome) and iOS device too. The same test link: https://image.faradise.ru/arcore.html
Did we mess up something after the update? We turned on automatic updates for this mini-project.
cdata commentedon Sep 3, 2019
@AytoMaximo We have a similar report in #736
@elalish I'm tentatively creating a v0.6.1 milestone in case we discover a rendering regression
AytoMaximo commentedon Sep 3, 2019
@cdata I've noticed a very funny thing: my Xiaomi Redmi 4A is not showing model in the scene anymore (before it was just black). The situation is the same in our test project and in model-viewer.glitch.me
elalish commentedon Sep 4, 2019
@AytoMaximo Thanks for the info! I've looked at your model and I think I know why it's black: It has an entirely black AO (ambient occlusion) map:


I also noticed something strange with the shadow when I turned that on:
This leads me to believe something else is not quite right with this model - maybe triangle orientation? How was this model created?
One final question, @donmccurdy this model renders fine in your viewer, which makes me think one or the other of us has a bug. Are we somehow being more strict with our glTF parsing?
donmccurdy commentedon Sep 4, 2019
Is there a link to the model?
My viewer applies some direct light, which isn't affected by AO. If model-viewer is only using indirect lights, that (combined with a black AO map) may be why it's dark.
elalish commentedon Sep 4, 2019
Ah yes, that explains it! I used the test model link three posts up; you can pull the model out of that.
12 remaining items
elalish commentedon Sep 4, 2019
Thanks for the detailed analysis! Three.js does not apply AO to direct lighting, since this is a more basic lighting type. It is (and always has been) applied to environmental lighting, but you may not have noticed the difference since the render was dominated by the point lights. We recently removed the directional light from <model-viewer>, so all light is now environmental, which gives us a more consistent render because the two lighting types use different approximations. In fact the directional light was hiding a number of our own errors in environmental lighting which have since been corrected. In this case it was also hiding an AO error in the model.
elalish commentedon Sep 4, 2019
As for brightness, please take a look at our exposure attribute, which provides the easiest way to adjust this.
AytoMaximo commentedon Sep 4, 2019
So, I guess we need to find proper shade of gray color for AO map to make the model look not too bright :)
UPD: just noticed your comment about exposure - we’ll take a look, thank you!
Seems like old devices the only painful thing that remains...
donmccurdy commentedon Sep 4, 2019
Yeah I wouldn't recommend using AO as a method of controlling overall brightness – if it's going to be a uniform color, you may as well omit AO entirely or use solid white. Anything else is taking you off a physically-plausible rendering path — nothing ever really gets zero indirect light — and lighting adjustments from there on out will likely be hacks.
Environmental lighting is higher quality than punctual/analytical lighting like directional lights. Changing the IBL or changing exposure should be enough to get realistic results. One could debate whether AO should affect IBL, but that's a thorny question and not the source of the problem here. :)
AytoMaximo commentedon Sep 5, 2019
I guess the wrong scale causes broken shadows. I've found out the chair was exported with some errors, so it's x100 large. Maybe it's need to be handled in model-viewer in some way, maybe not - just sharing the info :)
elalish commentedon Sep 5, 2019
Thanks, that's very helpful! I was just cleaning up the shadow code, so I'll be sure to check that it works properly even at 100x scale in 0.7.
AytoMaximo commentedon Sep 5, 2019
Sounds great! We have some problems with the scale while converting models to GLB. So, if model-viewer can handle such cases, it will be very helpful))
elalish commentedon Sep 5, 2019
I plan to, but keep in mind, you definitely need proper scale for AR.
AytoMaximo commentedon Sep 5, 2019
Yes, sure)
Deankovitch commentedon Oct 21, 2020
I'm getting this "black faces error" also on pure Three JS project.
In my project, the model is partially black. I'm using FBX exported from Maya.
After checking everything from faces normals, to texture colors and UV smooth values, I decided to make a test recreating the material directly in Three JS. To my surprise, everything starts to render properly.
So, for those are facing this black faces issue in ThreeJS project, here's a workaround
Unfortunately for the model viewer there isn't a workaround since it is some kind of a black box around the base Three JS
elalish commentedon Oct 21, 2020
@Deankovitch What did you use to convert the FBX to glTF? That's what you'll want for model-viewer, and if it's generating black faces, please file a bug on that glTF exporter. Also make sure to check it with the Khronos glTF validator.