question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MeshStandardMaterial issue with normalMap

See original GitHub issue

Hi there! Thanks for the job guys!

Problem: When a normalMap is set to a MeshStandardMaterial we don’t get any visual “normal” effects and no warnings in OSX + any browser. All the other maps work: map, envMap, roughnessMap and metalicMap.

We’ve tried with many textures that work with MeshPhongMaterial to no sucess. Sizes tested: 256x256, 1024x1024 & 2048x2048, normal jpg textures.

When we use iOS 10 we get the following warning and no map is shown (and thus the texture is black):

WARNING: 0:256: Overflow in implicit constant conversion, minimum range for lowp float is (-2,2)

The same happens on some other computers (Win).

If we don’t set the normalMap the texture works Ok on iOS, but of course, we lack of bumps. I we set bumpMap instead no warning appears, the material appears ok in the screen but without bumps.

Three.js version
  • [] Dev
  • r81
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • Linux
  • Android
  • IOS

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SntsDevcommented, Nov 15, 2016

Thanks @WestLangley, that example works. But, as I mentioned, there are two examples that don’t work well with normal maps. I attached screenshots of the errors.

Some might work and some might not. That is the problem, its reliability.

I took a look at the shader chunk and followed a link to the inspiration source of it. There it says that sometimes the approach might break down whenever some conditions on the models met (check the part “When Does This Break Down”):

You may know from experience that tangent space normal mapping will fail if the author’s UV map is zero or one dimensional (that is, the author mapped a triangle in the mesh to a line or point on the UV map).”

This seems to be the the problem in my case. The modeler sent me a model with a UV map and it worked.

Do you think that you could add a way to detect this and do some logging so we can know when this is the problem?

1reaction
WestLangleycommented, Nov 5, 2016

@SntsDev wrote

I haven’t been able to find a computer where the normalMap is visible.

This MeshStandardMaterial with normalMap works for me on iOS 10 and macOS 10.12: http://threejs.org/examples/webgl_materials_displacementmap.html.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MeshStandardMaterial#normalMap – three.js docs
A standard physically based material, using Metallic-Roughness workflow. Physically based rendering (PBR) has recently become the standard in many 3D ...
Read more >
NormalMap - Three.js Tutorials
I have values as high as 10 in my example to make it more extreme. Below is the image used as the normal...
Read more >
textureLoader not working for a normal map - Stack Overflow
You render the scene with a normal map which is not yet fully loaded. ... MeshStandardMaterial({ metalness: 0.7, roughness: 0.2, normalMap: ...
Read more >
MeshStandardMaterial - nightloader
normalMap — Set normal map. Default is null. normalMapScale — Set normal map scale. Default is (1, 1). displacementMap — Set displacement map....
Read more >
A Brief Introduction to Texture Mapping | Discover three.js
Currently, our scene contains a single mesh with a shape defined by a BoxBufferGeometry and a surface defined by a MeshStandardMaterial with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found