DirectionalLight.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. DirectionalLight - A directional light
  2. --------------------------------------
  3. .. ...............................................................................
  4. .. rubric:: Constructor
  5. .. ...............................................................................
  6. .. class:: DirectionalLight( hex, intensity, distance )
  7. A directional light
  8. Part of scene graph
  9. Inherits from :class:`Light` :class:`Object3D`
  10. Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
  11. :param integer hex: light color
  12. :param float intensity: light intensity
  13. :param float distance: distance affected by light
  14. .. ...............................................................................
  15. .. rubric:: Attributes
  16. .. ...............................................................................
  17. .. attribute:: DirectionalLight.color
  18. Light :class:`Color`
  19. .. attribute:: DirectionalLight.intensity
  20. Light intensity
  21. ``default 1.0``
  22. .. attribute:: DirectionalLight.position
  23. Direction of the light is normalized vector from ``position`` to ``(0,0,0)``.
  24. .. attribute:: DirectionalLight.distance
  25. Modulating directional light by distance not implemented in :class:`WebGLRenderer`
  26. .. ...............................................................................
  27. .. rubric:: Shadow attributes
  28. .. ...............................................................................
  29. .. attribute:: DirectionalLight.castShadow
  30. If set to `true` light will cast dynamic shadows
  31. Warning: this is expensive and requires tweaking to get shadows looking right.
  32. ``default false``
  33. .. attribute:: DirectionalLight.onlyShadow
  34. If set to `true` light will only cast shadow but not contribute any lighting (as if intensity was 0 but cheaper to compute)
  35. ``default false``
  36. .. attribute:: DirectionalLight.target
  37. :class:`Object3D` target used for shadow camera orientation
  38. .. attribute:: DirectionalLight.shadowCameraNear
  39. Orthographic shadow camera frustum parameter
  40. ``default 50``
  41. .. attribute:: DirectionalLight.shadowCameraFar
  42. Orthographic shadow camera frustum parameter
  43. ``default 5000``
  44. .. attribute:: DirectionalLight.shadowCameraLeft
  45. Orthographic shadow camera frustum parameter
  46. ``default -500``
  47. .. attribute:: DirectionalLight.shadowCameraRight
  48. Orthographic shadow camera frustum parameter
  49. ``default 500``
  50. .. attribute:: DirectionalLight.shadowCameraTop
  51. Orthographic shadow camera frustum parameter
  52. ``default 500``
  53. .. attribute:: DirectionalLight.shadowCameraBottom
  54. Orthographic shadow camera frustum parameter
  55. ``default -500``
  56. .. attribute:: DirectionalLight.shadowCameraVisible
  57. Show debug shadow camera frustum
  58. ``default false``
  59. .. attribute:: DirectionalLight.shadowBias
  60. Shadow map bias
  61. ``default 0``
  62. .. attribute:: DirectionalLight.shadowDarkness
  63. Darkness of shadow casted by this light (``float`` from 0 to 1)
  64. ``default 0.5``
  65. .. attribute:: DirectionalLight.shadowMapWidth
  66. Shadow map texture width in pixels
  67. ``default 512``
  68. .. attribute:: DirectionalLight.shadowMapHeight
  69. Shadow map texture height in pixels
  70. ``default 512``
  71. .. ...............................................................................
  72. .. rubric:: Example
  73. .. ...............................................................................
  74. ::
  75. // white directional light at half intensity shining from the top
  76. var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
  77. directionalLight.position.set( 0, 1, 0 );
  78. scene.add( directionalLight );