Wrong GLSL generated when ENVMAP_TYPE_CUBE_UV is defined
See original GitHub issueWhile trying to use the CubeUVReflectionMapping
option on my envmap, I noticed GLSL compilation errors appearing in my log :
THREE.WebGLProgram: Shader Error 1282 - VALIDATE_STATUS false
Program Info Log: Fragment shader is not compiled.
FRAGMENT
ERROR: 0:484: '0.276' : syntax error
Below is an excerpt of the GLSL source code that is being compiled.
My understanding is that :
- a
#define v1 0.276
is done in cube_uv_reflection_fragment.glsl.js - no
#undef
follows - later a parameter is named
v1
inbsdfs.glsl.js
forLTC_EdgeVectorFormFactor
function - This
v1
is replaced by0.276
which gives the syntax error
...
320: #ifdef ENVMAP_TYPE_CUBE_UV
...
389: #define r0 1.0
390: #define v0 0.339
391: #define m0 - 2.0
392: #define r1 0.8
393: #define v1 0.276
394: #define m1 - 1.0
395: #define r4 0.4
396: #define v4 0.046
397: #define m4 2.0
398: #define r5 0.305
399: #define v5 0.016
400: #define m5 3.0
401: #define r6 0.21
402: #define v6 0.0038
403: #define m6 4.0
404: float roughnessToMip( float roughness ) {
405: float mip = 0.0;
406: if ( roughness >= r1 ) {
407: mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
408: } else if ( roughness >= r4 ) {
409: mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
410: } else if ( roughness >= r5 ) {
411: mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
412: } else if ( roughness >= r6 ) {
413: mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
414: } else {
415: mip = - 2.0 * log2( 1.16 * roughness ); }
416: return mip;
417: }
...
484: vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
...
Platform:
- Device: Desktop
- OS: Windows
- Browser: Chrome
- Three.js version: r133
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
GLSL : common mistakes - OpenGL Wiki
The following article discusses common mistakes made in the ... It is legal to have the same uniform defined in different shader stages....
Read more >GLSL Linker Error: Definition for "void main()" not found
Whenever I try to link the program, I encounter an error. Output: ERROR: definition for "void main()" not found. Vertex shader: #version 330...
Read more >Debugging - LearnOpenGL
Within OpenGL's function documentation you can always find the error codes a function generates the moment it is incorrectly used. For instance, if...
Read more >OpenGL Error when linking GLSL shaders due to variables ...
ERROR : Input of fragment shader '_input' not written by vertex shader. The error is generated by the following glsl code lines:
Read more >Use of deprecated texture2D() in OpenGL 3.1+ shaders
[OpenGL] Error high : SHADER_ID_COMPILE error has been generated. GLSL compile failed for shader 24, "": ERROR: 2:442: 'function' : is ...
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
Typically, not by the user.
You can get more help if you need it at https://discourse.threejs.org.
Do this, instead.