It could happen if computeVertexNormals() is applied an object that have seams (for uv unwrapping). computeVertexNormals doesn’t understand that face normals, calculated along the seam, need to be averaged with face normals across it. Incorrect normals will produce a mismatch in illumination.
I forgot to mention that the object I’m using is exported from blender as a glb file and I’m not sure how to use computeVertexNormals() since it seems to be a part of the BufferGeometry class.
I’m really new to all the 3D stuff, so I really can’t tell how their issue is related to mine.
Can you please explain it further?
If you link your .glb file here, then it’ll be possible to have a look at it and tell you for sure what causes the issue.
You can also post a simple working example of your code (including your scene and illumination) on jsfiddle or codepen.
I don’t know how to correctly load a file into jsfiddle (I’m getting CORS errors).
But I’ve made a rudimentary version you can just open within your browser.
The zip also includes the glb, but the html file uses the same glb through CORS.
Ok, I made an example on jsfiddle, from what I can see, it’s a problem with the normal map exported as a part of .glb file, I emphasized the scale of normals to see it more clearly:
Has nothing to do with THREE, needs to be fixed in Blender.
There is also a chance it’s a sphere not being perfectly smooth, but I don’t see any normal deviations by eye. Not sure how to test it with more precision without writing some code.
It’s a cube transformed into a sphere. I learned that somewhere for another fix. Using a uv-sphere resulted in stretched textures at the poles.
Do you think that might be the cause?
I would have guessed that the uv-islands within the normal map are oriented the wrong way. But on the other hand the “continents and islands” on the planet are in place.
And yes, now I see the problem in Blender as well, when I crank up the normal map strength. It seems like the normal map is getting this problem during the baking process.
I don’t think it’s a sphere, I wrote a shader to colorize the normal difference between the adjacent pixels - I don’t see any seams, so it’s most likely the normal map issue:
As you can see, the procedural normals are looking the way it should while the baked is doing some weird stuff. I could imagine that it has something to do with the Smart UV Project, but I’m not sure.
I don’t use Blender for baking, so it’s hard for me to tell what causes the issue.
Make a simple low-res example showing your problem and try to ask on Blender forums, with all the files attached, that’s probably the best way to solve this.