Skip to content
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

MeshStandardMaterial renders black on iOS #17113

Closed
3 tasks done
MrJoshBowman opened this issue Jul 27, 2019 · 7 comments
Closed
3 tasks done

MeshStandardMaterial renders black on iOS #17113

MrJoshBowman opened this issue Jul 27, 2019 · 7 comments

Comments

@MrJoshBowman
Copy link

Using Three.js v105-106

I've just switched all my Geometry object code over to creating pure BufferGeometry and when I was testing it on my laptop across browsers the mesh and textures appeared without issue.

However, when i tested them on iOS browsers, any BufferGeometry with a MeshStandardMaterial rendered as black, still with its texture alphas.

I tried switching back to standard Geometry with MeshStandardMaterial and everything worked fine on iOS again. I also swapped back to BufferGeometry and tried a MeshBasicMaterial and MeshLambertMaterial, both of which worked totally fine.

  • r106
Browser
  • all of them
OS
  • iOS v13 Public BETA
Hardware Requirements (graphics card, VR Device, ...)
  • iPhone X
  • iPad Pro 10.5"
@mrdoob
Copy link
Owner

mrdoob commented Jul 27, 2019

There isn't much we can do without a working link or a jsfiddle...

@MrJoshBowman
Copy link
Author

MrJoshBowman commented Jul 28, 2019

apologies, I couldn't replicate it using boilderplate code and the PlaneBufferGeometry.
I'm building my own PlaneBufferGeometry without indices (because I can't get indices working) but after jumping on the three.js Slack channel, it appears that the issue is solved by adding 'precision: 'mediump' ' to the MeshStandardMaterial, based on this already open bug report: #14137 so I'll close this.

UPDATE:
'mediump' was causing other issues so i did some more digging and discovered that because i hadn't specified normals for my custom BufferGeometry in the beginning, the texture started black, as soon as i ran '.computeVertexNormals()' over the BufferGeometry the MeshStandardShader worked on iOS without any further issues.

@WestLangley
Copy link
Collaborator

@MrJoshBowman Do not get into the habit of blaming the library when your code does not work.

@MrJoshBowman
Copy link
Author

MrJoshBowman commented Jul 28, 2019

I submitted it because it was inconsistent behaviour. In the year I've been learning three.js I haven't ever posted a bug report or blamed the library.

'mediump' ignores normals for the MeshStandardMaterial at creation of geo and buffergeo producing non-black squares, and MeshLambertMaterial ignores normals at creation of geo and buffergeo producing non-black squares, That's inconsistent behaviour in the MeshStandardMaterial library, which i had to find a work around for.

I'm fine with being accused of my code not working because of a library inconsistency 'gotcha', and that's why I updated my report. It works fine on PCs and laptops, just not iOS hardware.

@mrdoob
Copy link
Owner

mrdoob commented Jul 31, 2019

It works fine on PCs and laptops, just not iOS hardware.

Would be great if you could figure out why that's the case.

@schlaegerz
Copy link

I am getting a similar problem, my stuff renders with MeshStandardMaterial just fine on most devices, but then on Galaxy S9 it goes completely crazy. I haven't been able to isolate the problem with a jsfiddle as its part of a complicated system, but I do find it weird that it only reproes on some devices. I ended up just doing a work around and checking for the user agent string and then switching to MeshPhongMaterial if it is on android

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 20, 2019

but I do find it weird that it only reproes on some devices.

I'm afraid that's not unusual. Different devices have different GPUs and drivers. But without a live example for reproduction it is almost impossible to find the root cause for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants