Ver código fonte

workaround for Pixel PMREM (#23841)

* workaround for Pixel PMREM

* addressing feedback
Emmett Lalish 3 anos atrás
pai
commit
ba6140a50c

+ 4 - 4
src/extras/PMREMGenerator.js

@@ -247,7 +247,7 @@ class PMREMGenerator {
 	_allocateTargets() {
 	_allocateTargets() {
 
 
 		const width = 3 * Math.max( this._cubeSize, 16 * 7 );
 		const width = 3 * Math.max( this._cubeSize, 16 * 7 );
-		const height = 4 * this._cubeSize - 32;
+		const height = 4 * this._cubeSize;
 
 
 		const params = {
 		const params = {
 			magFilter: LinearFilter,
 			magFilter: LinearFilter,
@@ -588,9 +588,9 @@ function _createPlanes( lodMax ) {
 
 
 		sigmas.push( sigma );
 		sigmas.push( sigma );
 
 
-		const texelSize = 1.0 / ( sizeLod - 1 );
-		const min = - texelSize / 2;
-		const max = 1 + texelSize / 2;
+		const texelSize = 1.0 / ( sizeLod - 2 );
+		const min = - texelSize;
+		const max = 1 + texelSize;
 		const uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];
 		const uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];
 
 
 		const cubeFaces = 6;
 		const cubeFaces = 6;

+ 1 - 1
src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js

@@ -85,7 +85,7 @@ export default /* glsl */`
 
 
 		float faceSize = exp2( mipInt );
 		float faceSize = exp2( mipInt );
 
 
-		vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;
+		vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
 
 
 		if ( face > 2.0 ) {
 		if ( face > 2.0 ) {
 
 

+ 1 - 1
src/renderers/webgl/WebGLProgram.js

@@ -373,7 +373,7 @@ function generateCubeUVSize( parameters ) {
 
 
 	if ( imageHeight === null ) return null;
 	if ( imageHeight === null ) return null;
 
 
-	const maxMip = Math.log2( imageHeight / 32 + 1 ) + 3;
+	const maxMip = Math.log2( imageHeight ) - 2;
 
 
 	const texelHeight = 1.0 / imageHeight;
 	const texelHeight = 1.0 / imageHeight;