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

Support 'precision mediump float' in fragment shaders #74

Open
ianmackenzie opened this issue Apr 20, 2020 · 1 comment
Open

Support 'precision mediump float' in fragment shaders #74

ianmackenzie opened this issue Apr 20, 2020 · 1 comment
Assignees

Comments

@ianmackenzie
Copy link
Owner

Currently all elm-3d-scene shaders use precision highp float. It should be possible to use precision mediump float in at least the fragment shaders, by doing things like carefully clamping color values (specular lighting can result in very high color values).

If not possible in general, it may be possible to have a compromise like only use precision highp float in the PBR shaders and precision mediump float (or even precision lowp float) in shaders like those for Lambertian, emissive or constant-color materials where calculations should not result in particularly large values.

@ianmackenzie ianmackenzie self-assigned this Apr 20, 2020
ianmackenzie added a commit that referenced this issue Apr 20, 2020
Make sure high precision is used for spatial calculations and PBR shaders, can use low precision for plain color values etc. Part of #74, but will likely need more refinement/tweaking over time.
@ianmackenzie
Copy link
Owner Author

Specific improvements to make:

  • Replace sceneProperties in constantPointFragment with single lowp supersampling uniform
  • Replace sceneProperties in emissiveFragment and emissiveTextureFragment with separate mediump reference white and lowp dynamic range uniforms
  • Replace sceneProperties in emissivePointFragment with lowp supersampling, mediump reference white and lowp dynamic range uniforms

Looks like it will be difficult to avoid highp in Lambertian fragment shaders, though.

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

1 participant