PMREMGenerator - Verge3D User Manual - Soft8Soft
Description: Learn how to use PMREMGenerator in your interactive 3D apps made with Verge3D

# PMREMGenerator

This class generates a Prefiltered, Mipmapped Radiance Environment Map (PMREM) from a cube map environment texture. This allows different levels of blur to be quickly accessed based on material roughness. 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, maxTileSize : Integer)

This constructor creates a new PMREMGenerator. The `maxTileSize` specifies maximum tile size for PMREM. Default it `256`.

## Methods

### # .fromScene(scene : Scene, sigma : Float, near : Float, far : Float) → 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 cube camera is placed at the origin).

### # .fromEquirectangular(equirectangular : Texture) → WebGLRenderTarget

equirectangular — the equirectangular source texture.

Generates a PMREM from an equirectangular texture.

### # .fromCubemap(cubemap : CubeTexture) → WebGLRenderTarget

cubemap — the cubemap source texture.

Generates a PMREM from an cubemap texture.

### # .compileCubemapShader()

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()

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()

Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.

## Source

For more info on how to obtain the source code of this module see this page.