How to use two normal maps per material?

Hello,

I want to use two normal maps for my mesh since one is related to the material itself and the other is related to the mesh. I tried to achieve this with a detailmap but I realized that this won’t work. I don’t need diffuse and roughness of the detailmap so red and blue channel are wasted and the green channel isn’t enough for my normal map.

So my question is how to use two different normal maps for the same material. One normal map should point to uv map 1 and the other normal map should point to uv map 2. Do I have to create a node material or is there another way? If yes, how to create the node material? It should be 100% the same like the regular pbr material but with the opportunity to add a second normal map.

I appreciate your help.

Thanks!

You are going to either use NME or a ShaderMaterial as this is not something supported out of the box

Since I have no clue how to do that with shaderMaterial I will go with NME.

I noticed that there is a normalBlend node that fits my needs perfectly. I gave it a try and it works so far: https://nme.babylonjs.com/#LWL6BV#19

I have still some questions though:

  1. I have a uv map for each of both normal maps. But my normal blend node goes to pertubNormal wich has only one uv map slot. I noticed that it works without connecting a uv map to pertubNormal. But after saving it automatically connects to uv map 1. How to handle two uv maps?

  2. The intensity of the normal maps can be adjusted in pertubNormal but only for both normal maps simultaneously. To be able to control the strength of each normal map I used lerpBlocks and set bumpStrength just to 1. Is that correct?

  3. I also try to combine two ambient occlusion maps. One from the red channel of metallicRoughnessTexture and one via grayscale from an additional texture. How to do that?

  4. Do I have to implement morph target and bones to my nodeMaterial or are the automatically handled? If I have to implement it, is there an example of the correct node structure?

Thank you!

Best

  1. You should actually merge both maps before by using BlendNormal node
  2. it is smart :wink:
  3. use two texture blocks and then use color merger block
  4. You have morph target block and Bone block :slight_smile:

Hey @Deltakosh

Thanks for you reply.

  1. I merged them by using blendNormal and connected the output to the perturbNormalBlock. But the pertubNormalBlock need a uv map. So I am confused because I use two normal maps with one uv map each but I have to connect one uv map to the perturbNormalBlock.

  1. I will stay with that solution :slight_smile:

  2. Unfortunately colorMerger outputs rgb but ambientOcclusion in PBRBlock just takes one channel. I am not sure how to connect it appropriately.

  3. These blocks are great. Morph target and bones are working :slight_smile:

https://nme.babylonjs.com/#LWL6BV#21

  1. The uv is just used to get a map to build the tangents when not provided. So you may simply want to make sure your mesh has tangents (along with normals). your uvs will be important to parse the normal maps and you are already doing it
  2. Then why not either working with a multiply between the two incoming red channels?
  1. Oh dear, tangents are working very very well. Thanks for the hint!!
  2. I will try that. Thanks.