LOGTHREE.WebGLRenderer 99 LOG34 erc-background LOG30 background-image INFOLoaded project: 10539 LOG241 deserializer LOG[object Object] LOG424 deserializer LOG[object Object] LOG[object Object] WARNINGTHREE.WebGLShader: gl.getShaderInfoLog() fragment WARNING: 0:17: Overflow in implicit constant conversion, minimum range for lowp float is (-2,2) 1: precision highp float; 2: precision highp int; 3: #define SHADER_NAME SMAAWeightsMaterial 4: #define MAX_SEARCH_STEPS_INT 8 5: #define MAX_SEARCH_STEPS_FLOAT 8.0 6: #define AREATEX_MAX_DISTANCE 16.0 7: #define AREATEX_PIXEL_SIZE (1.0 / vec2(160.0, 560.0)) 8: #define AREATEX_SUBTEX_SIZE (1.0 / 7.0) 9: #define SEARCHTEX_SIZE vec2(66.0, 33.0) 10: #define SEARCHTEX_PACKED_SIZE vec2(64.0, 16.0) 11: #define GAMMA_FACTOR 2.2 12: uniform mat4 viewMatrix; 13: uniform vec3 cameraPosition; 14: #define TONE_MAPPING 15: #ifndef saturate 16: #define saturate(a) clamp( a, 0.0, 1.0 ) 17: #endif 18: uniform float toneMappingExposure; 19: uniform float toneMappingWhitePoint; 20: vec3 LinearToneMapping( vec3 color ) { 21: return toneMappingExposure * color; 22: } 23: vec3 ReinhardToneMapping( vec3 color ) { 24: color *= toneMappingExposure; 25: return saturate( color / ( vec3( 1.0 ) + color ) ); 26: } 27: #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 ) ) 28: vec3 Uncharted2ToneMapping( vec3 color ) { 29: color *= toneMappingExposure; 30: return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) ); 31: } 32: vec3 OptimizedCineonToneMapping( vec3 color ) { 33: color *= toneMappingExposure; 34: color = max( vec3( 0.0 ), color - 0.004 ); 35: return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 36: } 37: vec3 ACESFilmicToneMapping( vec3 color ) { 38: color *= toneMappingExposure; 39: return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) ); 40: } 41: vec3 toneMapping( vec3 color ) { return LinearToneMapping( color ); } 42: 43: vec4 LinearToLinear( in vec4 value ) { 44: return value; 45: } 46: vec4 GammaToLinear( in vec4 value, in float gammaFactor ) { 47: return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a ); 48: } 49: vec4 LinearToGamma( in vec4 value, in float gammaFactor ) { 50: return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a ); 51: } 52: vec4 sRGBToLinear( in vec4 value ) { 53: 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 ); 54: } 55: vec4 LinearTosRGB( in vec4 value ) { 56: 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 ); 57: } 58: vec4 RGBEToLinear( in vec4 value ) { 59: return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 ); 60: } 61: vec4 LinearToRGBE( in vec4 value ) { 62: float maxComponent = max( max( value.r, value.g ), value.b ); 63: float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 ); 64: return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 ); 65: } 66: vec4 RGBMToLinear( in vec4 value, in float maxRange ) { 67: return vec4( value.rgb * value.a * maxRange, 1.0 ); 68: } 69: vec4 LinearToRGBM( in vec4 value, in float maxRange ) { 70: float maxRGB = max( value.r, max( value.g, value.b ) ); 71: float M = clamp( maxRGB / maxRange, 0.0, 1.0 ); 72: M = ceil( M * 255.0 ) / 255.0; 73: return vec4( value.rgb / ( M * maxRange ), M ); 74: } 75: vec4 RGBDToLinear( in vec4 value, in float maxRange ) { 76: return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 ); 77: } 78: vec4 LinearToRGBD( in vec4 value, in float maxRange ) { 79: float maxRGB = max( value.r, max( value.g, value.b ) ); 80: float D = max( maxRange / maxRGB, 1.0 ); 81: D = min( floor( D ) / 255.0, 1.0 ); 82: return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D ); 83: } 84: const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 ); 85: vec4 LinearToLogLuv( in vec4 value ) { 86: vec3 Xp_Y_XYZp = value.rgb * cLogLuvM; 87: Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) ); 88: vec4 vResult; 89: vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z; 90: float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0; 91: vResult.w = fract( Le ); 92: vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0; 93: return vResult; 94: } 95: const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 ); 96: vec4 LogLuvToLinear( in vec4 value ) { 97: float Le = value.z * 255.0 + value.w; 98: vec3 Xp_Y_XYZp; 99: Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 ); 100: Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y; 101: Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z; 102: vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM; 103: return vec4( max( vRGB, 0.0 ), 1.0 ); 104: } 105: vec4 mapTexelToLinear( vec4 value ) { return GammaToLinear( value, float( GAMMA_FACTOR ) ); } 106: vec4 matcapTexelToLinear( vec4 value ) { return GammaToLinear( value, float( GAMMA_FACTOR ) ); } 107: vec4 envMapTexelToLinear( vec4 value ) { return GammaToLinear( value, float( GAMMA_FACTOR ) ); } 108: vec4 emissiveMapTexelToLinear( vec4 value ) { return GammaToLinear( value, float( GAMMA_FACTOR ) ); } 109: vec4 linearToOutputTexel( vec4 value ) { return LinearToGamma( value, float( GAMMA_FACTOR ) ); } 110: 111: #define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + float(offset) * texelSize, 0.0) 112: 113: uniform sampler2D inputBuffer; 114: uniform sampler2D areaTexture; 115: uniform sampler2D searchTexture; 116: 117: uniform vec2 texelSize; 118: 119: varying vec2 vUv; 120: varying vec4 vOffset[3]; 121: varying vec2 vPixCoord; 122: 123: vec2 round(vec2 x) { 124: 125: return sign(x) * floor(abs(x) + 0.5); 126: 127: } 128: 129: float searchLength(vec2 e, float bias, float scale) { 130: 131: // Not required if searchTexture accesses are set to point. 132: // const vec2 SEARCH_TEX_PIXEL_SIZE = 1.0 / vec2(66.0, 33.0); 133: // e = vec2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + e * vec2(scale, 1.0) * vec2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE; 134: 135: e.r = bias + e.r * scale; 136: 137: return 255.0 * texture2D(searchTexture, e, 0.0).r; 138: 139: } 140: 141: float searchXLeft(vec2 texCoord, float end) { 142: 143: /* @PSEUDO_GATHER4 144: This texCoord has been offset by (-0.25, -0.125) in the vertex shader to 145: sample between edge, thus fetching four edges in a row. 146: Sampling with different offsets in each direction allows to disambiguate 147: which edges are active from the four fetched ones. */ 148: 149: vec2 e = vec2(0.0, 1.0); 150: 151: for(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i) { 152: 153: e = texture2D(inputBuffer, texCoord, 0.0).rg; 154: texCoord -= vec2(2.0, 0.0) * texelSize; 155: 156: if(!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) { break; } 157: 158: } 159: 160: // Correct the previously applied offset (-0.25, -0.125). 161: texCoord.x += 0.25 * texelSize.x; 162: 163: // The searches are biased by 1, so adjust the coords accordingly. 164: texCoord.x += texelSize.x; 165: 166: // Disambiguate the length added by the last step. 167: texCoord.x += 2.0 * texelSize.x; // Undo last step. 168: texCoord.x -= texelSize.x * searchLength(e, 0.0, 0.5); 169: 170: return texCoord.x; 171: 172: } 173: 174: float searchXRight(vec2 texCoord, float end) { 175: 176: vec2 e = vec2(0.0, 1.0); 177: 178: for(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i) { 179: 180: e = texture2D(inputBuffer, texCoord, 0.0).rg; 181: texCoord += vec2(2.0, 0.0) * texelSize; 182: 183: if(!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) { break; } 184: 185: } 186: 187: texCoord.x -= 0.25 * texelSize.x; 188: texCoord.x -= texelSize.x; 189: texCoord.x -= 2.0 * texelSize.x; 190: texCoord.x += texelSize.x * searchLength(e, 0.5, 0.5); 191: 192: return texCoord.x; 193: 194: } 195: 196: float searchYUp(vec2 texCoord, float end) { 197: 198: vec2 e = vec2(1.0, 0.0); 199: 200: for(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i) { 201: 202: e = texture2D(inputBuffer, texCoord, 0.0).rg; 203: texCoord += vec2(0.0, 2.0) * texelSize; // Changed sign. 204: 205: if(!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) { break; } 206: 207: } 208: 209: texCoord.y -= 0.25 * texelSize.y; // Changed sign. 210: texCoord.y -= texelSize.y; // Changed sign. 211: texCoord.y -= 2.0 * texelSize.y; // Changed sign. 212: texCoord.y += texelSize.y * searchLength(e.gr, 0.0, 0.5); // Changed sign. 213: 214: return texCoord.y; 215: 216: } 217: 218: float searchYDown(vec2 texCoord, float end) { 219: 220: vec2 e = vec2(1.0, 0.0); 221: 222: for(int i = 0; i < MAX_SEARCH_STEPS_INT; ++i ) { 223: 224: e = texture2D(inputBuffer, texCoord, 0.0).rg; 225: texCoord -= vec2(0.0, 2.0) * texelSize; // Changed sign. 226: 227: if(!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) { break; } 228: 229: } 230: 231: texCoord.y += 0.25 * texelSize.y; // Changed sign. 232: texCoord.y += texelSize.y; // Changed sign. 233: texCoord.y += 2.0 * texelSize.y; // Changed sign. 234: texCoord.y -= texelSize.y * searchLength(e.gr, 0.5, 0.5); // Changed sign. 235: 236: return texCoord.y; 237: 238: } 239: 240: vec2 area(vec2 dist, float e1, float e2, float offset) { 241: 242: // Rounding prevents precision errors of bilinear filtering. 243: vec2 texCoord = AREATEX_MAX_DISTANCE * round(4.0 * vec2(e1, e2)) + dist; 244: 245: // Scale and bias for texel space translation. 246: texCoord = AREATEX_PIXEL_SIZE * texCoord + (0.5 * AREATEX_PIXEL_SIZE); 247: 248: // Move to proper place, according to the subpixel offset. 249: texCoord.y += AREATEX_SUBTEX_SIZE * offset; 250: 251: return texture2D(areaTexture, texCoord, 0.0).rg; 252: 253: } 254: 255: void main() { 256: 257: vec4 weights = vec4(0.0); 258: vec4 subsampleIndices = vec4(0.0); 259: vec2 e = texture2D(inputBuffer, vUv).rg; 260: 261: if(e.g > 0.0) { 262: 263: // Edge at north. 264: vec2 d; 265: 266: // Find the distance to the left. 267: vec2 coords; 268: coords.x = searchXLeft(vOffset[0].xy, vOffset[2].x); 269: coords.y = vOffset[1].y; // vOffset[1].y = vUv.y - 0.25 * texelSize.y (@CROSSING_OFFSET) 270: d.x = coords.x; 271: 272: /* Now fetch the left crossing edges, two at a time using bilinear 273: filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to discern what 274: value each edge has. */ 275: float e1 = texture2D(inputBuffer, coords, 0.0).r; 276: 277: // Find the distance to the right. 278: coords.x = searchXRight(vOffset[0].zw, vOffset[2].y); 279: d.y = coords.x; 280: 281: /* Translate distances to pixel units for better interleave arithmetic and 282: memory accesses. */ 283: d = d / texelSize.x - vPixCoord.x; 284: 285: // The area texture is compressed quadratically. 286: vec2 sqrtD = sqrt(abs(d)); 287: 288: // Fetch the right crossing edges. 289: coords.y -= texelSize.y; // WebGL port note: Added. 290: float e2 = sampleLevelZeroOffset(inputBuffer, coords, ivec2(1, 0)).r; 291: 292: // Pattern recognised, now get the actual area. 293: weights.rg = area(sqrtD, e1, e2, subsampleIndices.y); 294: 295: } 296: 297: if(e.r > 0.0) { 298: 299: // Edge at west. 300: vec2 d; 301: 302: // Find the distance to the top. 303: vec2 coords; 304: coords.y = searchYUp(vOffset[1].xy, vOffset[2].z); 305: coords.x = vOffset[0].x; // vOffset[1].x = vUv.x - 0.25 * texelSize.x; 306: d.x = coords.y; 307: 308: // Fetch the top crossing edges. 309: float e1 = texture2D(inputBuffer, coords, 0.0).g; 310: 311: // Find the distance to the bottom. 312: coords.y = searchYDown(vOffset[1].zw, vOffset[2].w); 313: d.y = coords.y; 314: 315: // Distances in pixel units. 316: d = d / texelSize.y - vPixCoord.y; 317: 318: // The area texture is compressed quadratically. 319: vec2 sqrtD = sqrt(abs(d)); 320: 321: // Fetch the bottom crossing edges. 322: coords.y -= texelSize.y; // WebGL port note: Added. 323: float e2 = sampleLevelZeroOffset(inputBuffer, coords, ivec2(0, 1)).g; 324: 325: // Get the area for this direction. 326: weights.ba = area(sqrtD, e1, e2, subsampleIndices.x); 327: 328: } 329: 330: gl_FragColor = weights; 331: 332: } 333: LOGLoading quality: low2 LOG3486 finalMaterial LOG71 background-controller LOG3486 finalMaterial LOG3486 finalMaterial LOG3486 finalMaterial ERRORFailed to load quality, falling back to High Quality. LOGLoading quality: low1 LOG3486 finalMaterial WARNINGTHREE.WebGLRenderer: image is too big (8192x8192). Resized to 4096x4096 LOG3486 finalMaterial WARNINGTHREE.WebGLRenderer: image is too big (8192x8192). Resized to 4096x4096 LOG3486 finalMaterial WARNINGTHREE.WebGLRenderer: image is too big (8192x8192). Resized to 4096x4096