gpt4 book ai didi

javascript - 来自 blender 的 babylon.js 纹理

转载 作者:行者123 更新时间:2023-11-29 18:19:12 25 4
gpt4 key购买 nike

当我尝试将场景从 Blender 导出到 Babylon.js 时,我遇到了一些基本问题(我认为)。我想我不太了解纹理的工作原理。

让我们举一个基本的例子。我在 Blender 上创建了一个新场景。只有一盏灯、一个相机和一个立方体。我对多维数据集选项没有任何更改。我只是在标准 Material 上应用来自 jpg 的纹理。它看起来像这样:

https://puu.sh/5FU6k.jpg

我使用 Babylon 导出器生成一个 .babylon 文件。但是当我导入它时,没有应用纹理。

结果:

https://puu.sh/5FUcM.jpg

我真的不明白为什么...要导入纹理,有什么特别的事情要做吗?

这是我的导入代码:

<script>
var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true);
BABYLON.SceneLoader.Load("", "test.babylon", engine, function (newScene) {
// Wait for textures and shaders to be ready
newScene.executeWhenReady(function () {
// Attach camera to canvas inputs
newScene.activeCamera.attachControl(canvas);

// Once the scene is loaded, just register a render loop to render it
engine.runRenderLoop(function() {
newScene.render();
});
});
}, function (progress) {
// To do: give progress feedback to user
});
</script>

最佳答案

Shivaan Keldon (提出问题的人)在评论中回答:

Got it ! When using textures with Babylon.js, you must unwrap the UV map before applying the texture in Blender !

关于javascript - 来自 blender 的 babylon.js 纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20452158/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com