ImportanceSampledEnvironment.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ImportanceSampledEnvironment - 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">ImportanceSampledEnvironment</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Manages a preprocessed HDR environment map (CDF textures, uniforms) and exposes
  16. TSL helpers for BRDF-direction lookups and MIS importance sampling.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="ImportanceSampledEnvironment" translate="no">new <a href="#ImportanceSampledEnvironment">ImportanceSampledEnvironment</a><span class="signature">( importanceSampling : <span class="param-type">boolean</span> )</span> </h3>
  22. <div class="method">
  23. <table class="params">
  24. <tbody>
  25. <tr>
  26. <td class="name">
  27. <strong translate="no">importanceSampling</strong>
  28. </td>
  29. <td class="description last">
  30. <p>When <code>true</code>, builds luminance CDF tables and enables MIS env sampling.</p>
  31. <p>Default is <code>false</code>.</p>
  32. </td>
  33. </tr>
  34. </tbody>
  35. </table>
  36. <dl class="details">
  37. <dt class="tag-see">See:</dt>
  38. <dd class="tag-see">
  39. <ul>
  40. <li><a href="https://github.com/gkjohnson/three-gpu-pathtracer" target="_blank" rel="noopener">https://github.com/gkjohnson/three-gpu-pathtracer</a></li>
  41. </ul>
  42. </dd>
  43. </dl>
  44. </div>
  45. </div>
  46. <h2 class="subsection-title">Methods</h2>
  47. <h3 class="name name-method" id="sampleEnvironmentBRDF" translate="no">.<a href="#sampleEnvironmentBRDF">sampleEnvironmentBRDF</a><span class="signature">( params : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  48. <div class="method">
  49. <div class="description">
  50. <p>Environment reflection for a screen-space miss using only the BRDF / reflected-ray direction.</p>
  51. </div>
  52. <table class="params">
  53. <tbody>
  54. <tr>
  55. <td class="name">
  56. <strong translate="no">params</strong>
  57. </td>
  58. <td class="description last">
  59. <table class="params">
  60. <tbody>
  61. <tr>
  62. <td class="name">
  63. <strong translate="no">cameraWorldMatrix</strong>
  64. </td>
  65. <td class="description last">
  66. </td>
  67. </tr>
  68. <tr>
  69. <td class="name">
  70. <strong translate="no">viewReflectDir</strong>
  71. </td>
  72. <td class="description last">
  73. <p>View-space GGX-sampled reflected ray.</p>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td class="name">
  78. <strong translate="no">N</strong>
  79. </td>
  80. <td class="description last">
  81. <p>View-space shading normal.</p>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td class="name">
  86. <strong translate="no">V</strong>
  87. </td>
  88. <td class="description last">
  89. <p>View-space direction to camera.</p>
  90. </td>
  91. </tr>
  92. <tr>
  93. <td class="name">
  94. <strong translate="no">alpha</strong>
  95. </td>
  96. <td class="description last">
  97. <p>GGX roughness (alpha).</p>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td class="name">
  102. <strong translate="no">f0</strong>
  103. </td>
  104. <td class="description last">
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. </td>
  110. </tr>
  111. </tbody>
  112. </table>
  113. </div>
  114. <h3 class="name name-method" id="sampleEnvironmentMIS" translate="no">.<a href="#sampleEnvironmentMIS">sampleEnvironmentMIS</a><span class="signature">( params : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  115. <div class="method">
  116. <div class="description">
  117. <p>Environment reflection for a screen-space miss, estimated with multiple importance
  118. sampling (MIS) between the BRDF / reflected-ray direction and the env-luminance CDF
  119. direction. Both techniques use consistent solid-angle PDFs (<code>D·G1(N·V)/(4·N·V)</code>), so
  120. the power heuristic is unbiased. Adapted from three-gpu-pathtracer.</p>
  121. </div>
  122. <table class="params">
  123. <tbody>
  124. <tr>
  125. <td class="name">
  126. <strong translate="no">params</strong>
  127. </td>
  128. <td class="description last">
  129. <table class="params">
  130. <tbody>
  131. <tr>
  132. <td class="name">
  133. <strong translate="no">cameraWorldMatrix</strong>
  134. </td>
  135. <td class="description last">
  136. </td>
  137. </tr>
  138. <tr>
  139. <td class="name">
  140. <strong translate="no">viewReflectDir</strong>
  141. </td>
  142. <td class="description last">
  143. <p>View-space GGX-sampled reflected ray.</p>
  144. </td>
  145. </tr>
  146. <tr>
  147. <td class="name">
  148. <strong translate="no">N</strong>
  149. </td>
  150. <td class="description last">
  151. <p>View-space shading normal.</p>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td class="name">
  156. <strong translate="no">V</strong>
  157. </td>
  158. <td class="description last">
  159. <p>View-space direction to camera.</p>
  160. </td>
  161. </tr>
  162. <tr>
  163. <td class="name">
  164. <strong translate="no">alpha</strong>
  165. </td>
  166. <td class="description last">
  167. <p>GGX roughness (alpha).</p>
  168. </td>
  169. </tr>
  170. <tr>
  171. <td class="name">
  172. <strong translate="no">f0</strong>
  173. </td>
  174. <td class="description last">
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="name">
  179. <strong translate="no">Xi2</strong>
  180. </td>
  181. <td class="description last">
  182. <p>Second blue-noise sample (zw used for the CDF).</p>
  183. </td>
  184. </tr>
  185. </tbody>
  186. </table>
  187. </td>
  188. </tr>
  189. </tbody>
  190. </table>
  191. <dl class="details">
  192. <dt class="tag-see">See:</dt>
  193. <dd class="tag-see">
  194. <ul>
  195. <li><a href="https://github.com/gkjohnson/three-gpu-pathtracer" target="_blank" rel="noopener">https://github.com/gkjohnson/three-gpu-pathtracer</a></li>
  196. </ul>
  197. </dd>
  198. </dl>
  199. </div>
  200. <h3 class="name name-method" id="sampleReflect" translate="no">.<a href="#sampleReflect">sampleReflect</a><span class="signature">( params : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  201. <div class="method">
  202. <div class="description">
  203. <p>Simple environment lookup along the reflected direction (no MIS).</p>
  204. </div>
  205. <table class="params">
  206. <tbody>
  207. <tr>
  208. <td class="name">
  209. <strong translate="no">params</strong>
  210. </td>
  211. <td class="description last">
  212. <table class="params">
  213. <tbody>
  214. <tr>
  215. <td class="name">
  216. <strong translate="no">cameraWorldMatrix</strong>
  217. </td>
  218. <td class="description last">
  219. </td>
  220. </tr>
  221. <tr>
  222. <td class="name">
  223. <strong translate="no">viewReflectDir</strong>
  224. </td>
  225. <td class="description last">
  226. </td>
  227. </tr>
  228. <tr>
  229. <td class="name">
  230. <strong translate="no">sampleWeight</strong>
  231. </td>
  232. <td class="description last">
  233. <p>Optional radiance scale (defaults to 1).</p>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. </td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. </div>
  243. <h3 class="name name-method" id="updateFrom" translate="no">.<a href="#updateFrom">updateFrom</a><span class="signature">( hdr : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span> </h3>
  244. <div class="method">
  245. <table class="params">
  246. <tbody>
  247. <tr>
  248. <td class="name">
  249. <strong translate="no">hdr</strong>
  250. </td>
  251. <td class="description last">
  252. <p>Equirectangular HDR environment map.</p>
  253. </td>
  254. </tr>
  255. </tbody>
  256. </table>
  257. </div>
  258. <h2 class="subsection-title">Source</h2>
  259. <p>
  260. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/ImportanceSampledEnvironment.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/ImportanceSampledEnvironment.js</a>
  261. </p>
  262. </article>
  263. </section>
  264. <script src="../scripts/linenumber.js"></script>
  265. <script src="../scripts/page.js"></script>
  266. </body>
  267. </html>
粤ICP备19079148号