Skip to content

Commit 25e4e94

Browse files
authored
Merge pull request #20490 from Mugen87/dev44
CubeTexture: Clarify envMap flip.
2 parents a5df208 + 86e4784 commit 25e4e94

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/textures/CubeTexture.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ function CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, forma
1111

1212
this.flipY = false;
1313

14+
// Why CubeTexture._needsFlipEnvMap is necessary:
15+
//
16+
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
17+
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
18+
// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.
19+
20+
// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped
21+
// and the flag _needsFlipEnvMap controls this conversion. The flip is not required (and thus _needsFlipEnvMap is set to false)
22+
// when using WebGLCubeRenderTarget.texture as a cube texture.
23+
1424
this._needsFlipEnvMap = true;
1525

1626
}

0 commit comments

Comments
 (0)