1
0

PMREMGenerator.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PMREMGenerator - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">PMREMGenerator</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This class generates a Prefiltered, Mipmapped Radiance Environment Map
  16. (PMREM) from a cubeMap environment texture. This allows different levels of
  17. blur to be quickly accessed based on material roughness. It is packed into a
  18. special CubeUV format that allows us to perform custom interpolation so that
  19. we can support nonlinear formats such as RGBE. Unlike a traditional mipmap
  20. chain, it only goes down to the LOD_MIN level (above), and then creates extra
  21. even more filtered 'mips' at the same LOD_MIN resolution, associated with
  22. higher roughness levels. In this way we maintain resolution to smoothly
  23. interpolate diffuse lighting while limiting sampling computation.</p>
  24. <p>The prefiltering uses GGX VNDF (Visible Normal Distribution Function)
  25. importance sampling based on &quot;Sampling the GGX Distribution of Visible Normals&quot;
  26. (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF
  27. used in material rendering for physically-based image-based lighting.</p></div>
  28. </header>
  29. <article>
  30. <div class="container-overview">
  31. <h2>Constructor</h2>
  32. <h3 class="name name-method" id="PMREMGenerator" translate="no">new <a href="#PMREMGenerator">PMREMGenerator</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span> )</span> </h3>
  33. <div class="method">
  34. <div class="description">
  35. <p>Constructs a new PMREM generator.</p>
  36. </div>
  37. <table class="params">
  38. <tbody>
  39. <tr>
  40. <td class="name">
  41. <strong>renderer</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The renderer.</p>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Methods</h2>
  52. <h3 class="name name-method" id="compileCubemapShader" translate="no">.<a href="#compileCubemapShader">compileCubemapShader</a><span class="signature">()</span> </h3>
  53. <div class="method">
  54. <div class="description">
  55. <p>Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during
  56. your texture's network fetch for increased concurrency.</p>
  57. </div>
  58. </div>
  59. <h3 class="name name-method" id="compileEquirectangularShader" translate="no">.<a href="#compileEquirectangularShader">compileEquirectangularShader</a><span class="signature">()</span> </h3>
  60. <div class="method">
  61. <div class="description">
  62. <p>Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during
  63. your texture's network fetch for increased concurrency.</p>
  64. </div>
  65. </div>
  66. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  67. <div class="method">
  68. <div class="description">
  69. <p>Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
  70. so you should not need more than one PMREMGenerator object. If you do, calling dispose() on
  71. one of them will cause any others to also become unusable.</p>
  72. </div>
  73. </div>
  74. <h3 class="name name-method" id="fromCubemap" translate="no">.<a href="#fromCubemap">fromCubemap</a><span class="signature">( cubemap : <span class="param-type"><a href="Texture.html">Texture</a></span>, renderTarget : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> )</span><span class="type-signature"> : <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  75. <div class="method">
  76. <div class="description">
  77. <p>Generates a PMREM from an cubemap texture, which can be either LDR
  78. or HDR. The ideal input cube size is 256 x 256,
  79. as this matches best with the 256 x 256 cubemap output.</p>
  80. </div>
  81. <table class="params">
  82. <tbody>
  83. <tr>
  84. <td class="name">
  85. <strong>cubemap</strong>
  86. </td>
  87. <td class="description last">
  88. <p>The cubemap texture to be converted.</p>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="name">
  93. <strong>renderTarget</strong>
  94. </td>
  95. <td class="description last">
  96. <p>The render target to use.</p>
  97. <p>Default is <code>null</code>.</p>
  98. </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <dl class="details">
  103. <dt class="tag-returns"><strong>Returns:</strong> The resulting PMREM.</dt>
  104. </dl>
  105. </div>
  106. <h3 class="name name-method" id="fromEquirectangular" translate="no">.<a href="#fromEquirectangular">fromEquirectangular</a><span class="signature">( equirectangular : <span class="param-type"><a href="Texture.html">Texture</a></span>, renderTarget : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> )</span><span class="type-signature"> : <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  107. <div class="method">
  108. <div class="description">
  109. <p>Generates a PMREM from an equirectangular texture, which can be either LDR
  110. or HDR. The ideal input image size is 1k (1024 x 512),
  111. as this matches best with the 256 x 256 cubemap output.</p>
  112. </div>
  113. <table class="params">
  114. <tbody>
  115. <tr>
  116. <td class="name">
  117. <strong>equirectangular</strong>
  118. </td>
  119. <td class="description last">
  120. <p>The equirectangular texture to be converted.</p>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td class="name">
  125. <strong>renderTarget</strong>
  126. </td>
  127. <td class="description last">
  128. <p>The render target to use.</p>
  129. <p>Default is <code>null</code>.</p>
  130. </td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. <dl class="details">
  135. <dt class="tag-returns"><strong>Returns:</strong> The resulting PMREM.</dt>
  136. </dl>
  137. </div>
  138. <h3 class="name name-method" id="fromScene" translate="no">.<a href="#fromScene">fromScene</a><span class="signature">( scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, sigma : <span class="param-type">number</span>, near : <span class="param-type">number</span>, far : <span class="param-type">number</span>, options : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  139. <div class="method">
  140. <div class="description">
  141. <p>Generates a PMREM from a supplied Scene, which can be faster than using an
  142. image if networking bandwidth is low. Optional sigma specifies a blur radius
  143. in radians to be applied to the scene before PMREM generation. Optional near
  144. and far planes ensure the scene is rendered in its entirety.</p>
  145. </div>
  146. <table class="params">
  147. <tbody>
  148. <tr>
  149. <td class="name">
  150. <strong>scene</strong>
  151. </td>
  152. <td class="description last">
  153. <p>The scene to be captured.</p>
  154. </td>
  155. </tr>
  156. <tr>
  157. <td class="name">
  158. <strong>sigma</strong>
  159. </td>
  160. <td class="description last">
  161. <p>The blur radius in radians.</p>
  162. <p>Default is <code>0</code>.</p>
  163. </td>
  164. </tr>
  165. <tr>
  166. <td class="name">
  167. <strong>near</strong>
  168. </td>
  169. <td class="description last">
  170. <p>The near plane distance.</p>
  171. <p>Default is <code>0.1</code>.</p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <td class="name">
  176. <strong>far</strong>
  177. </td>
  178. <td class="description last">
  179. <p>The far plane distance.</p>
  180. <p>Default is <code>100</code>.</p>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td class="name">
  185. <strong>options</strong>
  186. </td>
  187. <td class="description last">
  188. <p>The configuration options.</p>
  189. <p>Default is <code>{}</code>.</p>
  190. <table class="params">
  191. <tbody>
  192. <tr>
  193. <td class="name">
  194. <strong>size</strong>
  195. </td>
  196. <td class="description last">
  197. <p>The texture size of the PMREM.</p>
  198. <p>Default is <code>256</code>.</p>
  199. </td>
  200. </tr>
  201. <tr>
  202. <td class="name">
  203. <strong>position</strong>
  204. </td>
  205. <td class="description last">
  206. <p>The position of the internal cube camera that renders the scene.</p>
  207. <p>Default is <code>origin</code>.</p>
  208. </td>
  209. </tr>
  210. </tbody>
  211. </table>
  212. </td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. <dl class="details">
  217. <dt class="tag-returns"><strong>Returns:</strong> The resulting PMREM.</dt>
  218. </dl>
  219. </div>
  220. <h2 class="subsection-title">Source</h2>
  221. <p>
  222. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/PMREMGenerator.js" translate="no" target="_blank" rel="noopener">src/extras/PMREMGenerator.js</a>
  223. </p>
  224. </article>
  225. </section>
  226. <script src="../scripts/linenumber.js"></script>
  227. <script src="../scripts/page.js"></script>
  228. </body>
  229. </html>
粤ICP备19079148号