Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs for the Sky object instance #28529

Merged
merged 4 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions docs/examples/en/objects/Sky.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!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>

<h1>[name]</h1>
Mugen87 marked this conversation as resolved.
Show resolved Hide resolved

<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 - 0.6)<br />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for - 0.06?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not reason at all, sorry my mistake (I was testing phi). Is deleted already :)

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