Materials: Consider to use mediump for all shaders
See original GitHub issueDescription of the problem
Right now, the default precision for shader progams in three.js
is highp
. Issues like #14137 showed that this approach causes rendering problems especially on (older) mobile devices . Using mediump
would solve these issues and also improve the performance of the shader execution on mobile, see https://github.com/mrdoob/three.js/issues/14137#issuecomment-397850032.
The problem is that certain materials like MeshStandardMaterial
can not produce correct visual output with mediump
right now, see https://github.com/mrdoob/three.js/issues/14137#issuecomment-397856954. Changing certain parts of the shader souce code is necessary to solve this issue.
Three.js version
- Dev
- r94
- …
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Hardware Requirements (graphics card, VR Device, …)
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
When to choose highp, mediump, lowp in shaders
The spec says an implementation can always use a higher precision so on desktop both the vertex shader and fragment shader run in...
Read more >Materials - LearnOpenGL
Learn OpenGL . com provides good and clear modern 3.3+ OpenGL tutorials with clear examples. A great resource to learn modern OpenGL aimed...
Read more >Is it OK to use highp in fragment shaders for iOS/Android?
So I have been using precision mediump float; in all my fragment shaders so I don't have device compatibility issues. In some cases...
Read more >can't upgrade materials/textures - Unity Forum
The pink objects all have valid shaders before URP.2020.1.6f1 ... Incredibly bad considering how much Unity promotes using URP but stuff ...
Read more >Unreal Engine 4 Rendering Part 5: Shader Permutations
We're all familiar with this process as it happens every time we use the Material Editor in Unreal. Unfortunately there's an issue with ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m thinking this is something that is not that relevant/needed nowadays…
I think the option to set
mediump
by default and update all the required shader code so the lighting doesn’t break (#14570 (comment)) by @mrdoob was a good idea.Unfortunately I am not experienced enough to do that, but I hope someone who knows the area better finds this thread and gives it a go. I am more than willing to do the tests when needed with actual mobile hw.