1
0

Sky.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. <h1>[name]</h1>
  12. <p class="desc">
  13. [name] creates a ready to go sky environment for your scenes.
  14. </p>
  15. <h2>Import</h2>
  16. <p>
  17. [name] is an add-on, and therefore must be imported explicitly.
  18. See [link:#manual/introduction/Installation Installation / Addons].
  19. </p>
  20. <code>
  21. import { Sky } from 'three/addons/objects/Sky.js';
  22. </code>
  23. <h2>Code Example</h2>
  24. <code>
  25. const sky = new Sky();<br />
  26. sky.scale.setScalar( 450000 );<br />
  27. const phi = MathUtils.degToRad( 90 );<br />
  28. const theta = MathUtils.degToRad( 180 );<br />
  29. const sunPosition = new Vector3().setFromSphericalCoords( 1, phi, theta );<br />
  30. sky.material.uniforms.sunPosition.value = sunPosition;<br />
  31. scene.add( sky );
  32. </code>
  33. <h2>Examples</h2>
  34. <p>[example:webgl_shaders_sky misc / objects / Sky ]</p>
  35. <h2>Constructor</h2>
  36. <h3>[name]()</h3>
  37. <p>
  38. Create a new [name] instance.
  39. </p>
  40. <h2>Properties</h2>
  41. <p>
  42. [name] instance is a [page:Mesh] with a pre-defined [page:ShaderMaterial], so every property described here should be set using [page:Uniform]s.
  43. </p>
  44. <h3>[property:Number turbidity]</h3>
  45. <p>
  46. Haziness of the [name].
  47. </p>
  48. <h3>[property:Number rayleigh]</h3>
  49. <p>
  50. For a more detailed explanation see: [link:https://en.wikipedia.org/wiki/Rayleigh_scattering Rayleigh scattering] .
  51. </p>
  52. <h3>[property:Number mieCoefficient]</h3>
  53. <p>
  54. [link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] amount.
  55. </p>
  56. <h3>[property:Number mieDirectionalG]</h3>
  57. <p>
  58. [link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] direction.
  59. </p>
  60. <h3>[property:Vector3 sunPosition]</h3>
  61. <p>
  62. The position of the sun.
  63. </p>
  64. <h3>[property:Vector3 up]</h3>
  65. <p>
  66. The sun's elevation from the horizon, in degrees.
  67. </p>
  68. <h2>Source</h2>
  69. <p>
  70. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js examples/jsm/objects/Sky.js]
  71. </p>
  72. </body>
  73. </html>