You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found similar issue related to this, but in the drei repo: pmndrs/drei#1558
But in my case, it also happens on the MeshStandardMaterial with normalMap. I can't really be sure if it's related to the textures or not, but I tested different PBR materials online from different creators, and they exhibit similar results.
Look the images below. Everything is default, and yet the shine shown on the floor is not where the actual PointLight is. And what's worse, is that the offset is inconsistent. On certain camera angle you could see worse deviation.
Turns out the fix is very simple, I just need to change the Color Space of the normal map like so:
normalMap-colorSpace={THREE.LinearSRGBColorSpace}
Final results are at the bottom.
But this is where the problem lies. After a bit of testing, it seems the default Three.js (code below) would initialize colored textures (both map and normalMap) as THREE.NoColorSpace, thus the colors of your textures would be wrong but the normals are perfect.
constmat=newTHREE.MeshStandardMaterial();mat.map=map;mat.normalMap=normalMapmap.colorSpace=THREE.SRGBColorSpace;// To correct the base map
Meanwhile, R3F would apply all colored textures as THREE.SRGBColorSpace. So, as a result, you will get correctly colored base texture, but wrong normal.
<meshreceiveShadowposition={[0,0,0]}rotation={[-Math.PI/2,0,0]}><planeGeometryargs={[10,10]}/><meshStandardMaterialmap={map}normalMap={normalMap}// To correct the normal mapnormalMap-colorSpace={THREE.LinearSRGBColorSpace}/></mesh>
Is this an intentional behavior? If we're setting default values different from the official Three.js, why not automatically set normalMap color space to THREE.LinearSRGBColorSpace altogether? Since we don't expect normals to be defined as non-linear color space anyway.
Final result after correcting the normal map's color space:
I found similar issue related to this, but in the drei repo: pmndrs/drei#1558
But in my case, it also happens on the
MeshStandardMaterial
withnormalMap
. I can't really be sure if it's related to the textures or not, but I tested different PBR materials online from different creators, and they exhibit similar results.Look the images below. Everything is default, and yet the shine shown on the floor is not where the actual
PointLight
is. And what's worse, is that the offset is inconsistent. On certain camera angle you could see worse deviation.CodeSanbox: https://codesandbox.io/p/sandbox/volumetric-spotlight-forked-tq5t9v
Also, if I move the point light close to the surface, it somehow emits in a specific direction on the surface:
Which disappears if I remove the normalMap:
The text was updated successfully, but these errors were encountered: