问题描述
限时送ChatGPT账号..我想将立方体贴图绕 Y
轴旋转 180 度.
I'd like to rotate a cube map about Y
axis by 180 degrees.
scene = new THREE.Scene();
scene.background = new THREE.CubeTextureLoader()
.setPath( '/path/to/my/docs/' )
.load( [ 'posX.jpg', 'negX.jpg',
'posY.jpg', 'negY.jpg',
'posZ.jpg', 'negZ.jpg' ] );
// this doesn't work
scene.background.rotation.y = Math.PI;
我该怎么做?
推荐答案
可惜在 Three.js 中我无法使用 rotation
参数旋转我的立方体贴图:
Pity but in Three.js I have no possibility to rotate my cube map using rotation
parameter:
scene.background.rotation.y = Math.PI;
解决方案
就我而言,最简单的解决方案(我想围绕 Y 轴旋转它)是重命名构成立方体贴图侧面的 4 个图像,以将立方体(天空盒)重新定向 180 度.
Solution
The simplest solution in my case (I want to rotate it around Y axis) is to rename 4 images that form the sides of the cube map to reorient that cube (skybox) 180 degrees.
我们必须记住,默认 Three.js Camera
是朝向 -Z
方向.
We must remember that by default Three.js Camera
looks towards -Z
direction.
看看这些图片.左图描绘了一个默认的 6 个图像放置,以形成一个立方体贴图.右图表示绕 Y 轴 180 度重新定向的立方体.
Look at these pictures. Left image depicts a default 6-image-placement to form a cube map. Right image represents 180-degrees-about-Y-axis reoriented cube.
因此,为了重新定位,您只需要重命名 4 个源文件.下面的表格向您展示了如何:
So, for reorientation you just need to rename 4 source files. Here's a table showing you how to:
|--------------------|--------------------|
| "Default name" | "RENAMED" |
|--------------------|--------------------|
| posX.jpg | negX.jpg |
|--------------------|--------------------|
| negX.jpg | posX.jpg |
|--------------------|--------------------|
| posZ.jpg | negZ.jpg |
|--------------------|--------------------|
| negZ.jpg | posZ.jpg |
|--------------------|--------------------|
重命名过程后,将posY.jpg
和negY.jpg
图像旋转180度.
And after renaming process, rotate posY.jpg
and negY.jpg
images by 180 degrees.
这篇关于是否可以将立方体环境贴图围绕 Y 轴旋转 180 度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论