question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Materials: Consider to use mediump for all shaders

See original GitHub issue
Description 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:open
  • Created 5 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mrdoobcommented, Dec 6, 2022

I’m thinking this is something that is not that relevant/needed nowadays…

1reaction
Supernuijacommented, May 10, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found