Skip to content

Commit 2d75b4a

Browse files
authored
fixed cubemap dynamic example and small PMREMs (#23428)
1 parent c93db53 commit 2d75b4a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/webgl_materials_cubemap_dynamic.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,23 @@
7373

7474
//
7575

76-
cubeRenderTarget1 = new THREE.WebGLCubeRenderTarget( 256 );
76+
const envSize = 64; // minimum size for roughness >= 0.1
77+
78+
cubeRenderTarget1 = new THREE.WebGLCubeRenderTarget( envSize );
79+
cubeRenderTarget1.texture.image[0] = {width: envSize, height: envSize};
7780

7881
cubeCamera1 = new THREE.CubeCamera( 1, 1000, cubeRenderTarget1 );
7982

80-
cubeRenderTarget2 = new THREE.WebGLCubeRenderTarget( 256 );
83+
cubeRenderTarget2 = new THREE.WebGLCubeRenderTarget( envSize );
84+
cubeRenderTarget2.texture.image[0] = {width: envSize, height: envSize};
8185

8286
cubeCamera2 = new THREE.CubeCamera( 1, 1000, cubeRenderTarget2 );
8387

8488
//
8589

8690
material = new THREE.MeshStandardMaterial( {
8791
envMap: cubeRenderTarget2.texture,
88-
roughness: 0.2,
92+
roughness: 0.1,
8993
metalness: 1
9094
} );
9195

src/renderers/webgl/WebGLProgram.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ function generateCubeUVSize( parameters ) {
373373

374374
const texelHeight = 1.0 / imageHeight;
375375

376-
const texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 ) );
376+
const texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );
377377

378378
return { texelWidth, texelHeight, maxMip };
379379

0 commit comments

Comments
 (0)