Skip to content

Commit

Permalink
docs: add docs for the Sky object instance (mrdoob#28529)
Browse files Browse the repository at this point in the history
* 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 <michael.herzog@human-interactive.org>
  • Loading branch information
JaimeTorrealba and Mugen87 authored May 31, 2024
1 parent 1603f76 commit b9a846d
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 1 deletion.
91 changes: 91 additions & 0 deletions docs/examples/en/objects/Sky.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:Mesh] &rarr;

<h1>[name]</h1>

<p class="desc">
[name] creates a ready to go sky environment for your scenes.
</p>

<h2>Import</h2>

<p>
[name] is an add-on, and therefore must be imported explicitly.
See [link:#manual/introduction/Installation Installation / Addons].
</p>

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

<h2>Code Example</h2>

<code>
const sky = new Sky();<br />
sky.scale.setScalar( 450000 );<br />

const phi = MathUtils.degToRad( 90 );<br />
const theta = MathUtils.degToRad( 180 );<br />
const sunPosition = new Vector3().setFromSphericalCoords( 1, phi, theta );<br />

sky.material.uniforms.sunPosition.value = sunPosition;<br />

scene.add( sky );
</code>

<h2>Examples</h2>

<p>[example:webgl_shaders_sky misc / objects / Sky ]</p>

<h2>Constructor</h2>

<h3>[name]()</h3>
<p>
Create a new [name] instance.
</p>

<h2>Properties</h2>
<p>
[name] instance is a [page:Mesh] with a pre-defined [page:ShaderMaterial], so every property described here should be set using [page:Uniform]s.
</p>

<h3>[property:Number turbidity]</h3>
<p>
Haziness of the [name].
</p>
<h3>[property:Number rayleigh]</h3>
<p>
For a more detailed explanation see: [link:https://en.wikipedia.org/wiki/Rayleigh_scattering Rayleigh scattering] .
</p>
<h3>[property:Number mieCoefficient]</h3>
<p>
[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] amount.
</p>
<h3>[property:Number mieDirectionalG]</h3>
<p>
[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] direction.
</p>
<h3>[property:Vector3 sunPosition]</h3>
<p>
The position of the sun.
</p>
<h3>[property:Vector3 up]</h3>
<p>
The sun's elevation from the horizon, in degrees.
</p>

<h2>Source</h2>

<p>
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js examples/jsm/objects/Sky.js]
</p>
</body>
</html>
3 changes: 2 additions & 1 deletion docs/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@
},

"Objects": {
"Lensflare": "examples/en/objects/Lensflare"
"Lensflare": "examples/en/objects/Lensflare",
"Sky": "examples/en/objects/Sky"
},

"Post-Processing": {
Expand Down

0 comments on commit b9a846d

Please sign in to comment.