Skip to content

Commit b9a846d

Browse files
docs: add docs for the Sky object instance (#28529)
* docs: 27034 Add docs for the Sky Object instance * add inheritance information, delete random hardcode number in example * Update Sky.html Clean up. * Update Sky.html More clean up. --------- Co-authored-by: Michael Herzog <[email protected]>
1 parent 1603f76 commit b9a846d

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

docs/examples/en/objects/Sky.html

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<base href="../../../" />
6+
<script src="page.js"></script>
7+
<link type="text/css" rel="stylesheet" href="page.css" />
8+
</head>
9+
<body>
10+
[page:Mesh] &rarr;
11+
12+
<h1>[name]</h1>
13+
14+
<p class="desc">
15+
[name] creates a ready to go sky environment for your scenes.
16+
</p>
17+
18+
<h2>Import</h2>
19+
20+
<p>
21+
[name] is an add-on, and therefore must be imported explicitly.
22+
See [link:#manual/introduction/Installation Installation / Addons].
23+
</p>
24+
25+
<code>
26+
import { Sky } from 'three/addons/objects/Sky.js';
27+
</code>
28+
29+
<h2>Code Example</h2>
30+
31+
<code>
32+
const sky = new Sky();<br />
33+
sky.scale.setScalar( 450000 );<br />
34+
35+
const phi = MathUtils.degToRad( 90 );<br />
36+
const theta = MathUtils.degToRad( 180 );<br />
37+
const sunPosition = new Vector3().setFromSphericalCoords( 1, phi, theta );<br />
38+
39+
sky.material.uniforms.sunPosition.value = sunPosition;<br />
40+
41+
scene.add( sky );
42+
</code>
43+
44+
<h2>Examples</h2>
45+
46+
<p>[example:webgl_shaders_sky misc / objects / Sky ]</p>
47+
48+
<h2>Constructor</h2>
49+
50+
<h3>[name]()</h3>
51+
<p>
52+
Create a new [name] instance.
53+
</p>
54+
55+
<h2>Properties</h2>
56+
<p>
57+
[name] instance is a [page:Mesh] with a pre-defined [page:ShaderMaterial], so every property described here should be set using [page:Uniform]s.
58+
</p>
59+
60+
<h3>[property:Number turbidity]</h3>
61+
<p>
62+
Haziness of the [name].
63+
</p>
64+
<h3>[property:Number rayleigh]</h3>
65+
<p>
66+
For a more detailed explanation see: [link:https://en.wikipedia.org/wiki/Rayleigh_scattering Rayleigh scattering] .
67+
</p>
68+
<h3>[property:Number mieCoefficient]</h3>
69+
<p>
70+
[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] amount.
71+
</p>
72+
<h3>[property:Number mieDirectionalG]</h3>
73+
<p>
74+
[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] direction.
75+
</p>
76+
<h3>[property:Vector3 sunPosition]</h3>
77+
<p>
78+
The position of the sun.
79+
</p>
80+
<h3>[property:Vector3 up]</h3>
81+
<p>
82+
The sun's elevation from the horizon, in degrees.
83+
</p>
84+
85+
<h2>Source</h2>
86+
87+
<p>
88+
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js examples/jsm/objects/Sky.js]
89+
</p>
90+
</body>
91+
</html>

docs/list.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@
378378
},
379379

380380
"Objects": {
381-
"Lensflare": "examples/en/objects/Lensflare"
381+
"Lensflare": "examples/en/objects/Lensflare",
382+
"Sky": "examples/en/objects/Sky"
382383
},
383384

384385
"Post-Processing": {

0 commit comments

Comments
 (0)