threejs中,使用GUI控制纹理的颜色空间为什么不能生效?-灵析社区

爱打瞌睡的三角龙

gui.add(params, 'colorSpace', { sRGB: 'sRGB', Linear: 'Linear' }).onChange((val) => { texture.dispose(); // 释放旧纹理 texture = textureLoader.load('./textures/your_texture.jpg', function(t) { if (val === 'sRGB') { t.encoding = THREE.sRGBEncoding; } else { t.encoding = THREE.LinearEncoding; } }); material.map = texture; // 更新材质的纹理 material.needsUpdate = true; // 标记材质需要更新 });

阅读量:1

点赞量:0

问AI