MeshDistanceMaterial.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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:Material] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. [name] is internally used for implementing shadow mapping with
  14. [page:PointLight]s.<br /><br />
  15. Can also be used to customize the shadow casting of an object by assigning
  16. an instance of [name] to [page:Object3D.customDistanceMaterial]. The
  17. following examples demonstrates this approach in order to ensure
  18. transparent parts of objects do no cast shadows.
  19. </p>
  20. <h2>Examples</h2>
  21. <p>[example:webgl_shadowmap_pointlight WebGL / shadowmap / pointlight]</p>
  22. <script>
  23. // iOS iframe auto-resize workaround
  24. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  25. const scene = document.getElementById( 'scene' );
  26. scene.style.width = getComputedStyle( scene ).width;
  27. scene.style.height = getComputedStyle( scene ).height;
  28. scene.setAttribute( 'scrolling', 'no' );
  29. }
  30. </script>
  31. <h2>Constructor</h2>
  32. <h3>[name]( [param:Object parameters] )</h3>
  33. <p>
  34. [page:Object parameters] - (optional) an object with one or more
  35. properties defining the material's appearance. Any property of the
  36. material (including any property inherited from [page:Material]) can be
  37. passed in here.
  38. </p>
  39. <h2>Properties</h2>
  40. <p>See the base [page:Material] class for common properties.</p>
  41. <h3>[property:Texture alphaMap]</h3>
  42. <p>
  43. The alpha map is a grayscale texture that controls the opacity across the
  44. surface (black: fully transparent; white: fully opaque). Default is
  45. null.<br /><br />
  46. Only the color of the texture is used, ignoring the alpha channel if one
  47. exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer
  48. will use the green channel when sampling this texture due to the extra bit
  49. of precision provided for green in DXT-compressed and uncompressed RGB 565
  50. formats. Luminance-only and luminance/alpha textures will also still work
  51. as expected.
  52. </p>
  53. <h3>[property:Texture displacementMap]</h3>
  54. <p>
  55. The displacement map affects the position of the mesh's vertices. Unlike
  56. other maps which only affect the light and shade of the material the
  57. displaced vertices can cast shadows, block other objects, and otherwise
  58. act as real geometry. The displacement texture is an image where the value
  59. of each pixel (white being the highest) is mapped against, and
  60. repositions, the vertices of the mesh.
  61. </p>
  62. <h3>[property:Float displacementScale]</h3>
  63. <p>
  64. How much the displacement map affects the mesh (where black is no
  65. displacement, and white is maximum displacement). Without a displacement
  66. map set, this value is not applied. Default is `1`.
  67. </p>
  68. <h3>[property:Float displacementBias]</h3>
  69. <p>
  70. The offset of the displacement map's values on the mesh's vertices.
  71. Without a displacement map set, this value is not applied. Default is `0`.
  72. </p>
  73. <h3>[property:Boolean fog]</h3>
  74. <p>Whether the material is affected by fog. Default is `false`.</p>
  75. <h3>[property:Texture map]</h3>
  76. <p>
  77. The color map. May optionally include an alpha channel, typically combined
  78. with [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  79. Default is null.
  80. </p>
  81. <h2>Methods</h2>
  82. <p>See the base [page:Material] class for common methods.</p>
  83. <h2>Source</h2>
  84. <p>
  85. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  86. </p>
  87. </body>
  88. </html>