DirectionalLight.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr; [page:Light] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">
  14. Affects objects using [page:MeshLambertMaterial] or [page:MeshPhongMaterial].
  15. </div>
  16. <h2>Example</h2>
  17. <div>[example:canvas_morphtargets_horse morphtargets / horse ]</div>
  18. <div>[example:misc_controls_fly controls / fly ]</div>
  19. <div>[example:misc_lights_test lights / test ]</div>
  20. <div>[example:vr_cubes cubes ]</div>
  21. <div>[example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]</div>
  22. <div>[example:webgl_effects_stereo effects / stereo ]</div>
  23. <div>[example:webgl_geometry_extrude_splines geometry / extrude / splines ]</div>
  24. <div>[example:webgl_materials_bumpmap materials / bumpmap ]</div>
  25. <div>[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ]</div>
  26. <code>// White directional light at half intensity shining from the top.
  27. var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
  28. directionalLight.position.set( 0, 1, 0 );
  29. scene.add( directionalLight );</code>
  30. <h2>Constructor</h2>
  31. <h3>[name]([page:Integer hex], [page:Float intensity])</h3>
  32. <div>
  33. [page:Integer hex] -- Numeric value of the RGB component of the color. <br />
  34. [page:Float intensity] -- Numeric value of the light's strength/intensity.
  35. </div>
  36. <div>
  37. Creates a light that shines from a specific direction not from a specific position. This light will behave
  38. as though it is infinitely far away and the rays produced from it are all parallel. The best
  39. analogy would be a light source that acts like the sun: the sun is so far away that all sunlight
  40. hitting objects comes from the same angle.
  41. </div>
  42. <h2>Properties</h2>
  43. <h3>[property:Object3D target]</h3>
  44. <div>
  45. Target used for shadow camera orientation.
  46. </div>
  47. <h3>[property:Float intensity]</h3>
  48. <div>
  49. Light's intensity.<br />
  50. In "physically correct" mode, the product of intensity * color is interpreted as luminous irradiance measured in lux at the material's surface.<br/>
  51. Default — *1.0*.
  52. </div>
  53. <h3>[property:Boolean castShadow]</h3>
  54. <div>
  55. If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right.<br />
  56. Default — *false*.
  57. </div>
  58. <h3>[property:Float shadowCameraNear]</h3>
  59. <div>
  60. Orthographic shadow camera frustum parameter.<br />
  61. Default — *50*.
  62. </div>
  63. <h3>[property:Float shadowCameraFar]</h3>
  64. <div>
  65. Orthographic shadow camera frustum parameter.<br />
  66. Default — *5000*.
  67. </div>
  68. <h3>[property:Float shadowCameraLeft]</h3>
  69. <div>
  70. Orthographic shadow camera frustum parameter.<br />
  71. Default — *-500*.
  72. </div>
  73. <h3>[property:Float shadowCameraRight]</h3>
  74. <div>
  75. Orthographic shadow camera frustum parameter.<br />
  76. Default — *500*.
  77. </div>
  78. <h3>[property:Float shadowCameraTop]</h3>
  79. <div>
  80. Orthographic shadow camera frustum parameter.<br />
  81. Default — *500*.
  82. </div>
  83. <h3>[property:Float shadowCameraBottom]</h3>
  84. <div>
  85. Orthographic shadow camera frustum parameter.<br />
  86. Default — *-500*.
  87. </div>
  88. <h3>[property:Boolean shadowCameraVisible]</h3>
  89. <div>
  90. Show debug shadow camera frustum.<br />
  91. Default — *false*.
  92. </div>
  93. <h3>[property:Float shadowBias]</h3>
  94. <div>
  95. Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.<br />
  96. Default — *0*.
  97. </div>
  98. <h3>[property:Integer shadowMapWidth]</h3>
  99. <div>
  100. Shadow map texture width in pixels.<br />
  101. Default — *512*.
  102. </div>
  103. <h3>[property:Integer shadowMapHeight]</h3>
  104. <div>
  105. Shadow map texture height in pixels.<br />
  106. Default — *512*.
  107. </div>
  108. <h3>[property:Vector2 shadowMapSize]</h3>
  109. <div>
  110. The shadowMapWidth and shadowMapHeight stored in a [page:Vector2 THREE.Vector2]. Set internally during rendering.
  111. </div>
  112. <h3>[property:OrthographicCamera shadowCamera]</h3>
  113. <div>
  114. The shadow's view of the world. Computed internally during rendering from the shadowCamera* settings.
  115. </div>
  116. <h3>[property:Matrix4 shadowMatrix]</h3>
  117. <div>
  118. Model to shadow camera space, to compute location and depth in shadow map. Computed internally during rendering.
  119. </div>
  120. <h3>[property:WebGLRenderTarget shadowMap]</h3>
  121. <div>
  122. The depth map generated using the shadowCamera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
  123. </div>
  124. <h2>Methods</h2>
  125. <h3>[method:DirectionalLight clone]()</h3>
  126. <div>
  127. It returns a clone of DirectionalLight.
  128. </div>
  129. <h3>[method:JSON toJSON]()</h3>
  130. <div>
  131. Return DirectionalLight data in JSON format.
  132. </div>
  133. <h2>Source</h2>
  134. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  135. </body>
  136. </html>