[page:Mesh] →

[name]

[name]为你的场景创建了一个准备就绪的天空环境。

导入

[name] 是一个插件,因此必须明确导入。 参见[link:#manual/introduction/Installation Installation / Addons].

import { Sky } from 'three/addons/objects/Sky.js';

代码示例

const sky = new Sky();
sky.scale.setScalar( 450000 );
const phi = MathUtils.degToRad( 90 );
const theta = MathUtils.degToRad( 180 );
const sunPosition = new Vector3().setFromSphericalCoords( 1, phi, theta );
sky.material.uniforms.sunPosition.value = sunPosition;
scene.add( sky );

示例

[example:webgl_shaders_sky misc / objects / Sky ]

构造函数

[name]()

创建一个[name]实例。

属性

[name]实例是一个带有预定义的 [page:ShaderMaterial]材质的[page:Mesh]模型, 因此这里描述的每个属性都应该使用[page:Uniform]s.

[property:Number turbidity]

[name]的浑浊度

[property:Number rayleigh]

更详细的解释参见: [link:https://en.wikipedia.org/wiki/Rayleigh_scattering Rayleigh scattering] .

[property:Number mieCoefficient]

[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering]数量。

[property:Number mieDirectionalG]

[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering]方向

[property:Vector3 sunPosition]

太阳的位置。

[property:Vector3 up]

太阳从地平线升起的角度,以度为单位。

源代码

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js examples/jsm/objects/Sky.js]