# How to apply HDRI(env)?

**URL:** <https://discourse.threejs.org/t/how-to-apply-hdri-env/218>\
**Category:** Questions\
**Tags:** cube-map, environment-map, hdr\
**Created:** [April 21, 2017, 6:45am UTC](https://discourse.threejs.org/t/how-to-apply-hdri-env/218 "2017-04-21T06:45:12Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![OliverXH](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/oliverxh/32/13263_2.png) [@OliverXH](https://discourse.threejs.org/u/OliverXH)\
**Post date:** [March 9, 2022, 9:27am UTC](https://discourse.threejs.org/t/how-to-apply-hdri-env/218/4 "2022-03-09T09:27:17Z")

</div>

Use `RGBEloader` to load the `.hdr` file, and in callback function use `PMREMGenerator` to generate the map from this HDR file. Then set the `envMap` parameter for your physical material:

```javascript
let generator = new THREE.PMREMGenerator(renderer);

new RGBELoader().load('textures/gothic_manor_02_2k.hdr', (hdrmap) => {
    // ...
    let envmap = generator.fromEquirectangular(hdrmap);
    const ballMaterial = {
        // ...
        envMap: envmap.texture
    };
});

```

> **[Gothic Manor 02 HDRI • Poly Haven](https://polyhaven.com/a/gothic_manor_02)**
>
> Download this free HDRI from Poly Haven

---

_[View the full topic](https://discourse.threejs.org/t/how-to-apply-hdri-env/218)._
