I’m recreating a PBR material in NME using a PBRMetallicRoughness block and I’ve noticed that when I include a bumpTexture
using perturbNormal
input I get color mismatch across the mesh faces.
What increases the prevalence of this issue is when the bumpTexture
has large uScale, vScale values and/or bumpLevel
Example in my app:
Recreated in NME:
NME recreating the issues: https://nme.babylonjs.com/#VSBYPV#11
The problem is not so evident using the default models so you would need to load this model to re-pro the issue: https://storage.googleapis.com/models.remakeable.com/9t6PHARBau4CPR/ModelFiles/tshirtv6.glb
Thanks in advance for any help please let me know if I can provide additional info here.
Can you repro in the Playground the first version (what you call “Example in my app”)?
It will allow us to compare with the nme version, which is (I have simplified the node material to the minimum):
Thanks for setting that up!
I can notice the issue in that minimal playground you provided. It’s super faint but there is a color different across the seams of the meshes. (Front and back of shirt are two separate meshes)
It becomes really evident when I introduce a hem / directional light: https://playground.babylonjs.com/#68E80V#3
The strength value of the PerturbNormal
block is way too big, it introduces artefacts because of that. The normal value is 1, and you can go around 2 or 3 max, but 100 is really too much. If you stick with values < 10, you will see you get the same color for both parts. Note that it is not related to node materials, you would get the same result with a regular PBR material if you set bumpTexture.level = 100
.
1 Like
Appreciate the insight @Evgeni_Popov. I tried again with PBRMaterials at that level to verify and you’re indeed correct. It’s less intense than in a NodeMaterial but still evident.
For some context: I use such high levels is because I’m trying to reduce the model size as much as possible – using super small tileable normals with high uScale
/vScale
and then a larger level
value to compensate.
I updated the playground to better replicate the actual code I’m running and still found that even when decreasing the bumpTexture.level
to 3 the issue would persist with large-ish uScale/vScale values:
However… I discovered that disableLevelMultiplication
would significantly reduce the artifacts and allow me to crank the level up to 30,40,50 and beyond with minimal distortion. Demo w/ disableLevelMultiplication = true
.
I consider this resolved now but if I may ask one more question for my own understanding what does disableLevelMultiplication
do exactly? Automatically increase the level
based on uScale/vScale
?
The docs state this but I don’t quite understand what it means.
Gets or sets a boolean indicating if multiplication of texture with level should be disabled
Thanks again!! Very helpful as always.
By default, the value read from a texture is multiplied by the texture level: color = value_read_from_texture * texture.level
.
When you disable level multiplication, the * texture.level
part is removed, so setting any value to texture.level
has no effect. In your material, you were in fact doing the multiplication two times: one in the bumpTexture
block as explained above, and another one through the strength input of the PerturbNormal
block.
2 Likes