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

'highp' : precision is not supported in fragment shader #9

Closed
vujadin opened this issue Dec 22, 2020 · 5 comments
Closed

'highp' : precision is not supported in fragment shader #9

vujadin opened this issue Dec 22, 2020 · 5 comments

Comments

@vujadin
Copy link
Contributor

vujadin commented Dec 22, 2020

This is error from an old android 7.0 device (Infinix Hot 5 Lite). I solved this issue by setting 'mediump' precision for fragment shaders - you should probably use PIXI.settings.PRECISION_FRAGMENT value (its 'mediump' by default but I think they determine its value at runtime ??). Pixi also has PRECISION_VERTEX (https://pixijs.download/dev/docs/PIXI.settings.html#PRECISION_VERTEX).

Then another problem happened as 3D models were not visible with this warning in console:
unsupported index buffer type: uint32
Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly

This was also solved by using Uint16Array (in only 2 places, I've done both of these changes in generated js file).
So check for Uint32Array support would be good too.

@jnsmalm
Copy link
Owner

jnsmalm commented Dec 22, 2020

Could you please specify where in the code you did these changes?

@vujadin
Copy link
Contributor Author

vujadin commented Dec 22, 2020

I've replaced Uint32Array with Uint16Array in two places where geometry index buffers are created:
https://github.com/jnsmalm/pixi3d/blob/develop/src/mesh/mesh-shader.ts#L33
https://github.com/jnsmalm/pixi3d/blob/develop/src/shadow/shadow-shader.ts#L23

@vujadin
Copy link
Contributor Author

vujadin commented Dec 22, 2020

And for shaders, where ever I found "gl_FragColor". There were 5 of them in js file so I guess its these:
https://github.com/jnsmalm/pixi3d/search?q=highp

Game was crashing on this one specifically, its probably the first one to be used:
https://github.com/jnsmalm/pixi3d/blob/76338386dba9a153009cd7a262df1a0e113a86f6/src/shadow/shader/gaussian-blur.frag

@jnsmalm
Copy link
Owner

jnsmalm commented Dec 22, 2020

I may have fixed the issues with Uint32Array and "highp". Please get latest from develop branch, build it, and let me know if it works better for you.

Something to have in mind though: If the model contains very many triangles (with indices) you will still get some error from PIXI if the device doesn't support uint32 (can't do anything about that - in that case the user of PIXI3D have to use simpler models). About highp/mediump, if the device doesn't support highp it may not render correctly (depending on the setup of the material and lighting).

@vujadin
Copy link
Contributor Author

vujadin commented Dec 23, 2020

Tested on two devices with a problem - Samsung J2 and Infinix Hot 5 Lite, works fine on both.
I'm aware of those limitations. We're using super low-poly models and very basic lighting - single directional light. This works for us, everything is rendered correctly.
Thanks!

@vujadin vujadin closed this as completed Dec 23, 2020
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

2 participants