# How to map PBRMaterial to PBRMetallicRoughness material?

**URL:** <https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136>\
**Category:** Questions\
**Created:** [April 19, 2021, 11:10pm UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136 "2021-04-19T23:10:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yofetahe\_Habtu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yofetahe_habtu/32/14561_2.png) [@Yofetahe\_Habtu](https://forum.babylonjs.com/u/Yofetahe_Habtu)\
**Post date:** [April 19, 2021, 11:10pm UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/1 "2021-04-19T23:10:31Z")

</div>

Hey,

The model I have uses PBR material. I added a node material to generate reflection and the reflection works but the new change overridden the properties of existing PBR material. The model PBRMaterial’s channels applies Metallic Roughness, Emissive, and Ambient texture.

I am able to apply Emissive texture together with baseColor via AddBlock connect to PBRMetallicRoughness’s baseColor input node. But I m not sure how to add the other textures.

So my question is - how can I map properties from PBRMaterial to the PBRMetallicRoughness to keep the feel of the original model?

here is the node material editor screenshot

 ![PBR_Texture_Question](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/6/60d33ca6907b953c0f745ef7741f0eb4f8597978.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 20, 2021, 9:45am UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/2 "2021-04-20T09:45:03Z")

</div>

The block is named `PBRMetallicRoughness` in the NME to emphasize it is using the metallic/roughness and not the specular / glosiness model but it is really mapping the `PBRMaterial`.

So:

- the `AmbientTexture` should be linked to the `ambientColor` input.
- the `EmissiveTexture` should be a component added at the very end, between the `PBRMetallicRoughness.lighting` output and the `FragmentOutput.rgb` input. Make sure to perform the sum `lighting + emissive` in linear space! The `lighting` output is in gamma space, so you will need to convert it to linear (`lighting_linear=lighting_gamma^2.2`). For the emissive texture block, just select “Convert to linear space”. To convert the result of the sum back to gamma space for display purpose, you can either apply a `^(1/2.2)` to the result of the sum or select `Convert to gamma space` on the `FragmentOutput` block.
- the channel corresponding to **metallic** in `MetallicRoughnessTexture` should be linked to the `PBRMetallicRoughness.metallic` input and the channel corresponding to **roughness** in `MetallicRoughnessTexture` should be linked to the `PBRMetallicRoughness.roughness` input

---

<div class="post-metadata">

**Author:** ![Yofetahe\_Habtu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yofetahe_habtu/32/14561_2.png) [@Yofetahe\_Habtu](https://forum.babylonjs.com/u/Yofetahe_Habtu)\
**Post date:** [April 20, 2021, 9:54pm UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/3 "2021-04-20T21:54:36Z")

</div>

@Evgeni_Popov Thanks for the reply. I implement the first two points as you described.

I want to make sure how I map MetallicRoughnessTexture.

Under the original PBRMaterial’s channel I found the combination of metallic and roughness texture slot. And a texture applied to it.  
 ![channels](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/f/fae76c8440aabc4e1133bff877cf965bbdc2416b.png)  
So what I took that texture replace PBRMetallicRoughness’s metallic and roughness node value with blue and green value of the texture respectively.  
 ![MetallicRoughnessQuestion](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/43398c5590bcf3ab6f6895342149634a8d60427b.png)  
I did the mapping because I saw a tutorial on youtube ( [(194) PBR Nodes in Node Materials Part 3 - YouTube](https://www.youtube.com/watch?v=Yy__nlCePnE)) doing the same. So is that the right way to implement it?

thanks in advance.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 20, 2021, 10:08pm UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/4 "2021-04-20T22:08:48Z")

</div>

In the video, Patrick created a texture for use in the NME only, not for the regular `PBRMaterial`, so he could put metallic/roughness wherever he wanted.

If on the contrary you want to recreate a node material that matches a default `PBRMaterial`, the metallic component is the red channel of the `metallicRoughness` texture and the roughness component is the alpha channel.

---

<div class="post-metadata">

**Author:** ![Yofetahe\_Habtu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yofetahe_habtu/32/14561_2.png) [@Yofetahe\_Habtu](https://forum.babylonjs.com/u/Yofetahe_Habtu)\
**Post date:** [April 22, 2021, 6:35pm UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/5 "2021-04-22T18:35:46Z")

</div>

Thanks @Evgeni_Popov

---

<div class="post-metadata">

**Author:** ![cptSwing](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@cptSwing](https://forum.babylonjs.com/u/cptSwing)\
**Post date:** [February 14, 2022, 4:14pm UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/7 "2022-02-14T16:14:26Z")

</div>

> [@Evgeni\_Popov](#):
>
> the `EmissiveTexture` should be a component added at the very end, between the `PBRMetallicRoughness.lighting` output and the `FragmentOutput.rgb` input. Make sure to perform the sum `lighting + emissive` in linear space! The `lighting` output is in gamma space, so you will need to convert it to linear ( `lighting_linear=lighting_gamma^2.2` ). For the emissive texture block, just select “Convert to linear space”. To convert the result of the sum back to gamma space for display purpose, you can either apply a `^(1/2.2)` to the result of the sum or select `Convert to gamma space` on the `FragmentOutput` block.

Hey Evgeni, just a quick question!

Assuming that our Emissive map is gamma-corrected (since it’s a color map), would simply adding it to the ‘lighting’ output be enough then? This would also apply to our (gamma-corrected) lightmaps

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 15, 2022, 11:58am UTC](https://forum.babylonjs.com/t/how-to-map-pbrmaterial-to-pbrmetallicroughness-material/20136/8 "2022-02-15T11:58:45Z")

</div>

Yes it can be enough, but note it’s not 100% accurate and you won’t get the same results than performing all the computations in linear space and only gamma correcting the result:

`a^0.4545+b^0.4545 != (a+b)^0.4545`

`a` and `b` being in linear space and `^0.4545` performing the conversion to gamma space.
