Advertisement
Guest User

shaderError

a guest
Dec 14th, 2019
1,174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.84 KB | None | 0 0
  1. index.js:1375 THREE.WebGLProgram: shader error: 0 35715 false gl.getProgramInfoLog No compiled fragment shader when at least one graphics shader is attached.
  2. THREE.WebGLShader: gl.getShaderInfoLog() vertex
  3. ERROR: 0:50: 'precision' : unexpected token after conditional expression
  4. ERROR: 0:50: 'ifdef' : unexpected end of file found in conditional block
  5. 1: precision highp float;
  6. 2: precision highp int;
  7. 3: #define HIGH_PRECISION
  8. 4: #define SHADER_NAME ShaderMaterial
  9. 5: #define VERTEX_TEXTURES
  10. 6: #define GAMMA_FACTOR 2
  11. 7: #define MAX_BONES 0
  12. 8: #define BONE_TEXTURE
  13. 9: uniform mat4 modelMatrix;
  14. 10: uniform mat4 modelViewMatrix;
  15. 11: uniform mat4 projectionMatrix;
  16. 12: uniform mat4 viewMatrix;
  17. 13: uniform mat3 normalMatrix;
  18. 14: uniform vec3 cameraPosition;
  19. 15: uniform bool isOrthographic;
  20. 16: #ifdef USE_INSTANCING
  21. 17: attribute mat4 instanceMatrix;
  22. 18: #endif
  23. 19: attribute vec3 position;
  24. 20: attribute vec3 normal;
  25. 21: attribute vec2 uv;
  26. 22: #ifdef USE_TANGENT
  27. 23: attribute vec4 tangent;
  28. 24: #endif
  29. 25: #ifdef USE_COLOR
  30. 26: attribute vec3 color;
  31. 27: #endif
  32. 28: #ifdef USE_MORPHTARGETS
  33. 29: attribute vec3 morphTarget0;
  34. 30: attribute vec3 morphTarget1;
  35. 31: attribute vec3 morphTarget2;
  36. 32: attribute vec3 morphTarget3;
  37. 33: #ifdef USE_MORPHNORMALS
  38. 34: attribute vec3 morphNormal0;
  39. 35: attribute vec3 morphNormal1;
  40. 36: attribute vec3 morphNormal2;
  41. 37: attribute vec3 morphNormal3;
  42. 38: #else
  43. 39: attribute vec3 morphTarget4;
  44. 40: attribute vec3 morphTarget5;
  45. 41: attribute vec3 morphTarget6;
  46. 42: attribute vec3 morphTarget7;
  47. 43: #endif
  48. 44: #endif
  49. 45: #ifdef USE_SKINNING
  50. 46: attribute vec4 skinIndex;
  51. 47: attribute vec4 skinWeight;
  52. 48: #endif
  53. 49:
  54. 50: #ifdef GL_ES precision highp float; #endif
  55. 51: varying vec2 texcoord; void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); texcoord = uv;} THREE.WebGLShader: gl.getShaderInfoLog() fragment
  56. ERROR: 0:106: 'precision' : unexpected token after conditional expression
  57. ERROR: 0:106: 'ifdef' : unexpected end of file found in conditional block
  58. ERROR: 0:185: '' : syntax error
  59. 1: precision highp float;
  60. 2: precision highp int;
  61. 3: #define HIGH_PRECISION
  62. 4: #define SHADER_NAME ShaderMaterial
  63. 5: #define GAMMA_FACTOR 2
  64. 6: uniform mat4 viewMatrix;
  65. 7: uniform vec3 cameraPosition;
  66. 8: uniform bool isOrthographic;
  67. 9: #define TONE_MAPPING
  68. 10: #ifndef saturate
  69. 11: #define saturate(a) clamp( a, 0.0, 1.0 )
  70. 12: #endif
  71. 13: uniform float toneMappingExposure;
  72. 14: uniform float toneMappingWhitePoint;
  73. 15: vec3 LinearToneMapping( vec3 color ) {
  74. 16: return toneMappingExposure * color;
  75. 17: }
  76. 18: vec3 ReinhardToneMapping( vec3 color ) {
  77. 19: color *= toneMappingExposure;
  78. 20: return saturate( color / ( vec3( 1.0 ) + color ) );
  79. 21: }
  80. 22: #define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
  81. 23: vec3 Uncharted2ToneMapping( vec3 color ) {
  82. 24: color *= toneMappingExposure;
  83. 25: return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
  84. 26: }
  85. 27: vec3 OptimizedCineonToneMapping( vec3 color ) {
  86. 28: color *= toneMappingExposure;
  87. 29: color = max( vec3( 0.0 ), color - 0.004 );
  88. 30: return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  89. 31: }
  90. 32: vec3 ACESFilmicToneMapping( vec3 color ) {
  91. 33: color *= toneMappingExposure;
  92. 34: return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );
  93. 35: }
  94. 36: vec3 toneMapping( vec3 color ) { return LinearToneMapping( color ); }
  95. 37:
  96. 38: vec4 LinearToLinear( in vec4 value ) {
  97. 39: return value;
  98. 40: }
  99. 41: vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
  100. 42: return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
  101. 43: }
  102. 44: vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
  103. 45: return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
  104. 46: }
  105. 47: vec4 sRGBToLinear( in vec4 value ) {
  106. 48: return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
  107. 49: }
  108. 50: vec4 LinearTosRGB( in vec4 value ) {
  109. 51: return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
  110. 52: }
  111. 53: vec4 RGBEToLinear( in vec4 value ) {
  112. 54: return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
  113. 55: }
  114. 56: vec4 LinearToRGBE( in vec4 value ) {
  115. 57: float maxComponent = max( max( value.r, value.g ), value.b );
  116. 58: float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
  117. 59: return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
  118. 60: }
  119. 61: vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
  120. 62: return vec4( value.rgb * value.a * maxRange, 1.0 );
  121. 63: }
  122. 64: vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
  123. 65: float maxRGB = max( value.r, max( value.g, value.b ) );
  124. 66: float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
  125. 67: M = ceil( M * 255.0 ) / 255.0;
  126. 68: return vec4( value.rgb / ( M * maxRange ), M );
  127. 69: }
  128. 70: vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
  129. 71: return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
  130. 72: }
  131. 73: vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
  132. 74: float maxRGB = max( value.r, max( value.g, value.b ) );
  133. 75: float D = max( maxRange / maxRGB, 1.0 );
  134. 76: D = min( floor( D ) / 255.0, 1.0 );
  135. 77: return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
  136. 78: }
  137. 79: const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
  138. 80: vec4 LinearToLogLuv( in vec4 value ) {
  139. 81: vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
  140. 82: Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
  141. 83: vec4 vResult;
  142. 84: vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
  143. 85: float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
  144. 86: vResult.w = fract( Le );
  145. 87: vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
  146. 88: return vResult;
  147. 89: }
  148. 90: const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
  149. 91: vec4 LogLuvToLinear( in vec4 value ) {
  150. 92: float Le = value.z * 255.0 + value.w;
  151. 93: vec3 Xp_Y_XYZp;
  152. 94: Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
  153. 95: Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
  154. 96: Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
  155. 97: vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
  156. 98: return vec4( max( vRGB, 0.0 ), 1.0 );
  157. 99: }
  158. 100: vec4 mapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
  159. 101: vec4 matcapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
  160. 102: vec4 envMapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
  161. 103: vec4 emissiveMapTexelToLinear( vec4 value ) { return LinearToLinear( value ); }
  162. 104: vec4 linearToOutputTexel( vec4 value ) { return LinearToLinear( value ); }
  163. 105:
  164. 106: #ifdef GL_ES precision highp float; #endif
  165. 107: #define PI 3.14159265359
  166. 108: #define PI2 6.28318530718
  167. 109: #define PI_HALF 1.5707963267949
  168. 110: #define RECIPROCAL_PI 0.31830988618
  169. 111: #define RECIPROCAL_PI2 0.15915494
  170. 112: #define LOG2 1.442695
  171. 113: #define EPSILON 1e-6
  172. 114: #ifndef saturate
  173. 115: #define saturate(a) clamp( a, 0.0, 1.0 )
  174. 116: #endif
  175. 117: #define whiteComplement(a) ( 1.0 - saturate( a ) )
  176. 118: float pow2( const in float x ) { return x*x; }
  177. 119: float pow3( const in float x ) { return x*x*x; }
  178. 120: float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  179. 121: float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
  180. 122: highp float rand( const in vec2 uv ) {
  181. 123: const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  182. 124: highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  183. 125: return fract(sin(sn) * c);
  184. 126: }
  185. 127: #ifdef HIGH_PRECISION
  186. 128: float precisionSafeLength( vec3 v ) { return length( v ); }
  187. 129: #else
  188. 130: float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  189. 131: float precisionSafeLength( vec3 v ) {
  190. 132: float maxComponent = max3( abs( v ) );
  191. 133: return length( v / maxComponent ) * maxComponent;
  192. 134: }
  193. 135: #endif
  194. 136: struct IncidentLight {
  195. 137: vec3 color;
  196. 138: vec3 direction;
  197. 139: bool visible;
  198. 140: };
  199. 141: struct ReflectedLight {
  200. 142: vec3 directDiffuse;
  201. 143: vec3 directSpecular;
  202. 144: vec3 indirectDiffuse;
  203. 145: vec3 indirectSpecular;
  204. 146: };
  205. 147: struct GeometricContext {
  206. 148: vec3 position;
  207. 149: vec3 normal;
  208. 150: vec3 viewDir;
  209. 151: #ifdef CLEARCOAT
  210. 152: vec3 clearcoatNormal;
  211. 153: #endif
  212. 154: };
  213. 155: vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  214. 156: return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  215. 157: }
  216. 158: vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  217. 159: return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  218. 160: }
  219. 161: vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  220. 162: float distance = dot( planeNormal, point - pointOnPlane );
  221. 163: return - distance * planeNormal + point;
  222. 164: }
  223. 165: float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
  224. 166: return sign( dot( point - pointOnPlane, planeNormal ) );
  225. 167: }
  226. 168: vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
  227. 169: return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
  228. 170: }
  229. 171: mat3 transposeMat3( const in mat3 m ) {
  230. 172: mat3 tmp;
  231. 173: tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  232. 174: tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  233. 175: tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  234. 176: return tmp;
  235. 177: }
  236. 178: float linearToRelativeLuminance( const in vec3 color ) {
  237. 179: vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
  238. 180: return dot( weights, color.rgb );
  239. 181: }
  240. 182: bool isPerspectiveMatrix( mat4 m ) {
  241. 183: return m[ 2 ][ 3 ] == - 1.0;
  242. 184: }
  243. 185: varying vec2 texcoord; uniform sampler2D text; uniform vec2 positions[16]; uniform float data[16]; const int num = 16; float colormap_red(float x) { if (x < 0.7) { return 4.0 * x - 1.5; } else { return -4.0 * x + 4.5; } } float colormap_green(float x) { if (x < 0.5) { return 4.0 * x - 0.5; } else { return -4.0 * x + 3.5; } } float colormap_blue(float x) { if (x < 0.3) { return 4.0 * x + 0.5; } else { return -4.0 * x + 2.5; } } vec4 colormap(float x) { float r = clamp(colormap_red(x), 0.0, 1.0); float g = clamp(colormap_green(x), 0.0, 1.0); float b = clamp(colormap_blue(x), 0.0, 1.0); return vec4(r, g, b, 1.0); } void main( void ) { float val = texture2D(text, texcoord).r; float finalcol = 0.; for(int i = 0; i < num; i++) { finalcol += data[i]*exp(-1.*pow((distance(positions[i], texcoord) / 0.05), 2.)); } gl_FragColor = colormap(clamp(finalcol * val, 0., 1.));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement