humbass

一个 Three.js 设置背景的问题求教

  •  
  •   humbass · Jun 1, 2024 · 1349 views
    This topic created in 749 days ago, the information mentioned may be changed or developed.

    想简单的设置个背景

      import test from '@/assets/test.jpg'
      scene = new THREE.Scene()
      const textureLoader = new THREE.TextureLoader()
      const texture = textureLoader.load(test)
      scene.background = texture
    
    

    结果发现图片是半透明的状态

    就像这样 https://update.ld160.eu.org/pics/2541717182785_.pic_hd.jpg 左上角是原图,右边是加载的背景

    3 replies    2024-06-01 19:42:12 +08:00
    IvanLi127
        1
    IvanLi127  
       Jun 1, 2024
    canvas 后面是啥颜色的?看起来不像半透明,只感觉色彩不太好
    alphardex
        2
    alphardex  
       Jun 1, 2024   ❤️ 1
    确实是色彩的问题,新版 three 默认是 SRGB 色彩空间,贴图的 colorSpace 也要对应上,texture.colorSpace = THREE.SRGBColorSpace
    humbass
        3
    humbass  
    OP
       Jun 1, 2024
    @alphardex 谢谢!上午换成老版本的 three.js 就 ok ,感谢!!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2474 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 07:25 · PVG 15:25 · LAX 00:25 · JFK 03:25
    ♥ Do have faith in what you're doing.