GLTF:我的场景与三个编辑器之间的金属差异https://threejs.org/editor/

发布于 2025-02-06 20:36:48 字数 1432 浏览 0 评论 0原文

我有一个GLTF文件。当我将其导入三个.js编辑器( https://threejs.org/editor/ )i获取正确的结果当我添加环境图时。

另一方面,当我在项目场景中导入GLTF时,我会不同的结果 。即使我使用相同的HDRI图像。在这种情况下,金属度太耀眼了。

有人知道我缺少什么吗?谢谢。

renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
renderer.outputEncoding = THREE.sRGBEncoding;

new RGBELoader()
    .load( 'royal_esplanade_1k.hdr', function ( texture ) {

        texture.mapping = THREE.EquirectangularReflectionMapping;
        scene.environment = texture;

    } );

loader.load(
    './gltf/canette.glb',

    // called when the resource is loaded
    function ( gltf ) {

        obj = gltf.scene;

        mixer = new THREE.AnimationMixer( gltf.scene );
        action = mixer.clipAction( gltf.animations[ 0 ] );
        

        //obj
        scene.add( obj );
    }
);

编辑:

在这里'sa sa live演示。 在这里 gltf模型。

I've got a gltf file. When I import it inside the Three.js editor (https://threejs.org/editor/) I get a correct result when I add an environment map.

On the other hand, when I import my gltf in my project scene I've a different result. Even when I use the very same HDRI image. The metalness is way too shinny in this case.

Does anyone know what I'm missing? Thank you.

renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
renderer.outputEncoding = THREE.sRGBEncoding;

new RGBELoader()
    .load( 'royal_esplanade_1k.hdr', function ( texture ) {

        texture.mapping = THREE.EquirectangularReflectionMapping;
        scene.environment = texture;

    } );

loader.load(
    './gltf/canette.glb',

    // called when the resource is loaded
    function ( gltf ) {

        obj = gltf.scene;

        mixer = new THREE.AnimationMixer( gltf.scene );
        action = mixer.clipAction( gltf.animations[ 0 ] );
        

        //obj
        scene.add( obj );
    }
);

EDIT :

Here's a live demo.
Here's the gltf model.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平安喜乐 2025-02-13 20:36:48

不幸的是,您使用的是与实际three.js版本不匹配的代码段。您必须至少使用r131(或者更好的是最新的r141)。现在,您正在使用R129

如果您使用three.js r131的版本,则必须使用pmRemgenerator来准备适用于PBR材料的环境图。从R131开始,引擎正在为您执行此操作,因此您不必担心PMRemganerator

Unfortunately, you are using a code snippet which does not match your actual three.js version. You have to use at least r131 (or better the latest one r141). Right now, you are using r129.

If you use three.js versions below r131, you have to use PMREMGenerator to prepare the environment map that you apply to PBR materials. Starting from r131, the engine is doing this for you so you don't have to worry about PMREMGenerator at all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文