elm-3d-scene
elm-3d-scene copied to clipboard
Support 'precision mediump float' in fragment shaders
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.
Specific improvements to make:
- [ ] Replace
sceneProperties
inconstantPointFragment
with singlelowp
supersampling uniform - [ ] Replace
sceneProperties
inemissiveFragment
andemissiveTextureFragment
with separatemediump
reference white andlowp
dynamic range uniforms - [ ] Replace
sceneProperties
inemissivePointFragment
withlowp
supersampling,mediump
reference white andlowp
dynamic range uniforms
Looks like it will be difficult to avoid highp
in Lambertian fragment shaders, though.