diff --git a/examples/js/loaders/FBXLoader.js b/examples/js/loaders/FBXLoader.js index 99219e9f577ced035120e28207984daba69015b2..0a9f37bf144aa18ec879b246439a7c1e3da417b3 100644 --- a/examples/js/loaders/FBXLoader.js +++ b/examples/js/loaders/FBXLoader.js @@ -3594,7 +3594,7 @@ function isFbxFormatBinary( buffer ) { - const CORRECT = 'Kaydara FBX Binary \0'; + const CORRECT = 'Kaydara\u0020FBX\u0020Binary\u0020\u0020\0'; return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString( buffer, 0, CORRECT.length ); } diff --git a/examples/js/shaders/SSRShader.js b/examples/js/shaders/SSRShader.js index 88e76460d2bbaffa631b8566765ecbb8278bff85..26b3212ff0389cb0feedf701f24d1defae5386ce 100644 --- a/examples/js/shaders/SSRShader.js +++ b/examples/js/shaders/SSRShader.js @@ -204,45 +204,48 @@ float viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z); #endif - if(viewReflectRayZ>vZ) continue; - - bool hit; - #ifdef INFINITE_THICK - hit=true; - #else - float away=pointToLineDistance(vP,viewPosition,d1viewPosition); - - float minThickness; - vec2 xyNeighbor=xy; - xyNeighbor.x+=1.; - vec2 uvNeighbor=xyNeighbor/resolution; - vec3 vPNeighbor=getViewPosition(uvNeighbor,d,cW); - minThickness=vPNeighbor.x-vP.x; - minThickness*=3.; - float tk=max(minThickness,thickness); - - hit=away<=tk; - #endif - - if(hit){ - vec3 vN=getViewNormal( uv ); - if(dot(viewReflectDir,vN)>=0.) continue; - float distance=pointPlaneDistance(vP,viewPosition,viewNormal); - if(distance>maxDistance) break; - float op=opacity; - #ifdef DISTANCE_ATTENUATION - float ratio=1.-(distance/maxDistance); - float attenuation=ratio*ratio; - op=opacity*attenuation; - #endif - #ifdef FRESNEL - float fresnelCoe=(dot(viewIncidentDir,viewReflectDir)+1.)/2.; - op*=fresnelCoe; + // if(viewReflectRayZ>vZ) continue; // will cause "npm run make-screenshot webgl_postprocessing_ssr" high probability hang. + // https://github.com/mrdoob/three.js/pull/21539#issuecomment-821061164 + if(viewReflectRayZ<=vZ){ + + bool hit; + #ifdef INFINITE_THICK + hit=true; + #else + float away=pointToLineDistance(vP,viewPosition,d1viewPosition); + + float minThickness; + vec2 xyNeighbor=xy; + xyNeighbor.x+=1.; + vec2 uvNeighbor=xyNeighbor/resolution; + vec3 vPNeighbor=getViewPosition(uvNeighbor,d,cW); + minThickness=vPNeighbor.x-vP.x; + minThickness*=3.; + float tk=max(minThickness,thickness); + + hit=away<=tk; #endif - vec4 reflectColor=texture2D(tDiffuse,uv); - gl_FragColor.xyz=reflectColor.xyz; - gl_FragColor.a=op; - break; + + if(hit){ + vec3 vN=getViewNormal( uv ); + if(dot(viewReflectDir,vN)>=0.) continue; + float distance=pointPlaneDistance(vP,viewPosition,viewNormal); + if(distance>maxDistance) break; + float op=opacity; + #ifdef DISTANCE_ATTENUATION + float ratio=1.-(distance/maxDistance); + float attenuation=ratio*ratio; + op=opacity*attenuation; + #endif + #ifdef FRESNEL + float fresnelCoe=(dot(viewIncidentDir,viewReflectDir)+1.)/2.; + op*=fresnelCoe; + #endif + vec4 reflectColor=texture2D(tDiffuse,uv); + gl_FragColor.xyz=reflectColor.xyz; + gl_FragColor.a=op; + break; + } } } } diff --git a/examples/jsm/loaders/FBXLoader.js b/examples/jsm/loaders/FBXLoader.js index f505b44ad805a518fe205436674b17204696b6ec..2cd5e7e0666a6c37416c01addd05d8d1d1802616 100644 --- a/examples/jsm/loaders/FBXLoader.js +++ b/examples/jsm/loaders/FBXLoader.js @@ -3892,7 +3892,7 @@ class FBXTree { function isFbxFormatBinary( buffer ) { - const CORRECT = 'Kaydara FBX Binary \0'; + const CORRECT = 'Kaydara\u0020FBX\u0020Binary\u0020\u0020\0'; return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString( buffer, 0, CORRECT.length );