代码之家  ›  专栏  ›  技术社区  ›  Adam Turaj

反应三纤维场景背景比原始图像更亮

  •  1
  • Adam Turaj  · 技术社区  · 2 年前

    Original issues image

    这是skybox的代码:

    const { scene } = useThree();
    
    const texture = useLoader(TextureLoader, "textures/skybox.jpg");
    
    scene.background = texture;
    

    Image of the scene

    (不要担心模糊。这只是因为我在屏幕上拍摄了一个如此小的区域。)

    我问的是我在Poimandres Discord服务器中询问的亮度,其中一位管理员说这可能是一个编码错误,并在这里提问。


    感谢马奎佐解决了这个问题。我刚刚补充说 texture.encoding = THREE.sRGBEncoding;

    Fixed background

    1 回复  |  直到 2 年前
        1
  •  1
  •   M -    2 年前

    这可能是你的 texture encoding property 默认情况下,纹理使用线性,但对于不与照明交互的直背景JPG,可以使用sRGB。

    const texture = useLoader(TextureLoader, "textures/skybox.jpg");
    texture.encoding = THREE.sRGBEncoding;
    scene.background = texture;