DirectionalLight.rst 2.9 KB

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