返回介绍

手册

参考

示例

开发者参考

PMREMGenerator

发布于 2021-07-10 14:14:15 字数 3410 浏览 2969 评论 0 收藏 0

This class generates a Prefiltered, Mipmapped Radiance Environment Map (PMREM) from a cubeMap environment texture. This allows different levels of blur to be quickly accessed based on material roughness. It is packed into a special CubeUV format that allows us to perform custom interpolation so that we can support nonlinear formats such as RGBE. Unlike a traditional mipmap chain, it only goes down to the LOD_MIN level (above), and then creates extra even more filtered 'mips' at the same LOD_MIN resolution, associated with higher roughness levels. In this way we maintain resolution to smoothly interpolate diffuse lighting while limiting sampling computation.

Constructor

PMREMGenerator( renderer : WebGLRenderer )

This constructor creates a new PMREMGenerator.

Methods

.fromScene ( scene : Scene, sigma : Number, near : Number, far : Number ) : WebGLRenderTarget

scene - The given scene.
sigma - (optional) Specifies a blur radius in radians to be applied to the scene before PMREM generation. Default is 0.
near - (optional) The near plane value. Default is 0.1.
far - (optional) The far plane value. Default is 100.

Generates a PMREM from a supplied Scene, which can be faster than using an image if networking bandwidth is low. Optional near and far planes ensure the scene is rendered in its entirety (the cubeCamera is placed at the origin).

.fromEquirectangular ( equirectangular : Texture ) : WebGLRenderTarget

equirectangular - The equirectangular texture.

Generates a PMREM from an equirectangular texture, which can be either LDR (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512), as this matches best with the 256 x 256 cubemap output.

.fromCubemap ( cubemap : CubeTexture ) : WebGLRenderTarget

cubemap - The cubemap texture.

Generates a PMREM from an cubemap texture, which can be either LDR (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256, as this matches best with the 256 x 256 cubemap output.

.compileCubemapShader () : void

Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during your texture's network fetch for increased concurrency.

.compileEquirectangularShader () : void

Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during your texture's network fetch for increased concurrency.

.dispose () : void

Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, so you should not need more than one PMREMGenerator object. If you do, calling dispose() on one of them will cause any others to also become unusable.

Source

src/extras/PMREMGenerator.js

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文