three.js: Examples: Problem with webgl_shaders_ocean
Description of the problem
I’ve discovered today that the current dev version of webgl_shaders_ocean does not work with Firefox 55.0.2 and Ubuntu 16.04 LTS. The water does not appear and i see some error messages in the browser console.
0:102(109): error: sampler arrays indexed with non-constant expressions are forbidden in GLSL 1.30 and later
And
Integer overflow trying to construct a fake vertex attrib 0 array for a draw-operation with -1 vertices. Try reducing the number of vertices.
Drawing without vertex attrib 0 array enabled forces the browser to do expensive emulation work when running on desktop OpenGL platforms, for example on Mac. It is preferable to always draw with vertex attrib 0 array enabled, by using bindAttribLocation to bind some always-used attribute to location 0.
The problem does not occur with Chromium. Besides, the live version of webgl_shaders_ocean works. So this error probably exists since the latest changes of THREE.Water, see #12167. If i revert the PR, the error does not appear.
/ping @Astrak
Three.js version
- Dev
- r87
- …
Browser
- [] All of them
- Chrome
- Firefox
- Internet Explorer
OS
- [] All of them
- Windows
- macOS
- Linux
- Android
- iOS
Hardware Requirements (graphics card, VR Device, …)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (14 by maintainers)
This bug is now fixed via #13140. Yay! 🎉 🙌
I guess we could try adding a
unrollLoopsproperty toShaderMaterial?Loop unrolling? There should be a flag or directive or something to force enable/disable it per loop
apologies for the question, but is there a […] at the end of the shader log where it gets cut off?
https://github.com/mrdoob/three.js/issues/12114
That’s correct, see https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLProgram.js#L509-L514
The only sampler that gets indexed with a non-constant expression seems to be
directionalShadowMapin line 668? No idea why it refers to0:102(109).668: shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;