当我尝试将场景从 Blender 导出到 Babylon.js 时,我遇到了一些基本问题(我认为)。我想我不太明白纹理是如何工作的。
让我们举一个基本的例子。我在 Blender 上创建了一个新场景。只有一盏灯、一台相机和一个立方体。我对多维数据集选项没有任何更改。我只是将 jpg 中的纹理应用到标准 Material 上。它看起来像这样:
我使用 Babylon 导出器来获得 .babylon 文件。但是当我导入它时,纹理没有应用。
结果:
我真的不明白为什么... 是否需要做一些特殊的事情来导入纹理?
这是我的导入代码:
<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/