New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All materials render black on some mobile devices #69
Comments
Your links don't work. |
There was an invisible space in the address, now fixed. |
I'm not a developer, so I can't assert what's correct, but IMHO, this is a per-device issue, at worst, a ThreeJS issue, not a end user software issue. If the device does not support highp but claims it does, there's nothing that can be done to solve this. |
That's a good idea to detect somehow if the device can't handle highp precision. In this case it can be modified here, because it can be set as a material parameter. The big question is how to detect such devices. |
I was thinking that some kind of simple check could be applied, where known colour object would be drawn on specific location (like the white cube) and then checked if the result on that pixel area is coloured black then parameter would be changed to mediump. How it is done codingwise, is up to someone who knows better. A simple check before loading the actual model. |
One quick test could be just changing https://threejs.org/docs/#api/en/renderers/WebGLRenderer.precision - value from Do you think that could try that setting for a day or two on your server and I could test if the problem is solved by that, and how it affects to the image quality and accessibility (all materials turning black issue) in various mobile devices? |
As I understand the documentation the default value is The problem is with the devices that say they support |
Three.js is considering changing the default value to What I was asking from you was that if you could change the value on your server (or some other test server if you have any) for a quick test so that it forces everything to mediump (notice that desktop is not affected by it, because it automatically always override this value to |
Here you have a version with precision set to Please let us know the results! |
Thanks a lot for the super quick action, I will give it a go and report as soon as I get all tests done! |
Just got all tests run and it was exactly as I suspected =) Here are all test results, so you can see yourself, all browsers are the latest available for those devices. There are now two test links on my server you can try yourself with different devices. At least I couldn't see any kind of difference in quality with these two settings displaying the same model. You can try these test sets and see yourself. https://quique.fi/talotesti.html - this one is with your site's normal |
Thanks for the check! The question is how can we make sure that it doesn't affect desktop at all. I've checked the three.js source code, and it generates the shaders with |
In my link where the test results are, in root folder there are two files that have both
I am confident that this render black issue will not go away and also that three.js team likes rather to develop all kind of more exciting new visual features than to solve something that is not actually their fault but someone elses (manufacturers and operators not making drivers correctly obeying standards, lacking proper testing and QA) For the end user this ia still a problem that prevents totally using the viewer in the worst case and there is nothing they can do about it. So it's 100% game stopper. |
@kovacsv How did you like my 2 proposals mentioned above? |
I've decided that the next release will have mediump as default. Reasons behind the decision:
|
Released in 0.7.10 version. |
Thanks for making that change! I am sure that this change will make your excellent 3DViewer more popular on the long run, when all models will display materials, no matter what kind of mobile devices are used, and how well HW/SW manufacturers have done their work. =) |
Reopen, because the fix caused a new bug: #75 |
@Supernuija, I had to revert back the changes, because it caused other issues in devices that had no problems before. Now I think the only way is to detect wrong hardware somehow. I've created a small experiment that - in theory - can detect the case when materials are black. Could you please try this link on devices where the error happens? It should write "Invalid driver detected" on the devices where the problem occurs, "Everything is OK" otherwise. |
I can confirm that your detection works perfectly! In every mobile device/browser combination it gave the correct answer. Applying this automatic detection to change Three.js should investigate thoroughly your detection method to figure out how to fix their end permanently, too. Awesome work, you really know your stuff !! When do you think you could apply this fix into your release? |
Let's detect the wrong devices, and set precision to mediump only if needed.
I've added the detection, @Supernuija if you have time for a final check, please check this url: |
That detection works perfectly! I did test it with all devices/browsers that are known to fail, and also compared model loading time perf between current version and this test version, and couldn't see any difference. That version is ready to be applied imho, thanks for your excellent work to solve this issue!! Your detection method should also be included to |
Thanks for the checking, I'll release it today. For the record, the checking code is not something I proud of. It just generates a red plane, and check if it's really red. A more elegant solution would be great, but at the moment it does the job. |
Fixed in 0.7.12 version. |
Great that you already released the fixed version! For the time being your solution is the best on the market ; ) - and any working solution is better than no solution at all. As I have mentioned before, in these kind of cases where different parties like HW and SW manufacturers just blame each other for something that doesn't work, and users suffer the consequences without any possibility to do anything about it, any working solutions are worth of gold. I perfectly understand why I am not sure if this is related to the same thing, but just recently someone had this issue: pmndrs/react-three-fiber#1388 - which might indicate that this problem persists even in new devices, if it has to do with the same bug. The fact is that new devices will come to market all the time, and this webgl side is still so new that QA side regarding it's functionality drags million miles behind. We can't control how well the others do their work, just our own end. Sometimes patching might be the only reasonable thing to do. |
Testing on various mobile devices (phones and pads) indicates that depending on the drivers, GPU:s and browser versions three.js may render all objects pitch-black. Mobile device having the same GPU/processor may behave differently depending on the phone model and year; older may work while newer doesn't. The same device may operate correctly with Chrome but not with Firefox etc.
The solution to this would be using material
precision: 'mediump'
on all mobile devices as a default value. Solving this has first been suggested in 2018 by @Mugen87 mrdoob/three.js#14570. These examples are from another thread, and I can confirm that this is an issue. Testing various devices using these two tests below confirmed it.This will show a white cube on all devices:
var material = newTHREE.MeshPhongMaterial( { precision: 'mediump' } );
https://jsfiddle.net/f2Lommf5/6721/embedded/result
This will not show a white cube on some devices, rendering it pitch-black
var material = new THREE.MeshPhongMaterial( { precision: 'highp' } );
https://jsfiddle.net/f2Lommf5/6722/embedded/result
IHMO is very important that 3D graphics operate flawlessly by default on all devices capable of running them, despite the bad drivers, operating systems, or browser versions.
Is anyone interested to investigate a solution to this? I am willing to test and confirm how possible solution works with various devices.
The text was updated successfully, but these errors were encountered: