three.js - Blender 4 Web 即使在加载页面后也会不断消耗 CPU

标签 three.js blender

我使用 Blender 创建了一个包含立方体和球体的简单场景.将其导出为 Blender 4 web json。我做了一个简单的网页如下。

index.html

<!DOCTYPE html>
<html>
<head>
<script src="b4w.full.min.js"></script>

<iframe allowfullscreen src="webplayer/webplayer.html?load=../SampleCube/samplecube.json" width="800" height="500"></iframe>

</html>

以上文件是使用这些指南创建的 Blender 4 Web Tutorial .

Where do you get the Web Player? You can copy the whole directory blend4web/deploy/apps/webplayer/ with the Web Player files from your Blend4Web SDK and deploy it on your website. JSON files can be exported in the same way as the HTML files File > Export > Blend4Web (.json). Upload your exported .json file (with the accompanying .bin file and possible textures) to your website and specify the path to it with the load attribute. Both absolute and relative URLs are supported.

当我运行上面的 HTML 时(我已经使用 python 在包含 index.html 的目录中启动了一个简单的 HTTP 服务器),如果 cpu 变高然后下降也没关系。但是,问题是这个网页一直在消耗恒定数量(比如 20%)的 CPU。为什么加载网页后仍然消耗 CPU。当我不在网页上执行任何操作(例如滚动、单击)时,我是否需要禁用 b4w 中的任何内容以减少 cpu 使用率。

最佳答案

它会持续消耗 CPU,因为即使我们没有与模型交互,Blender 引擎也会继续运行。

Blender 引擎可以在不需要时暂停,如下所示。 Blender 引擎可以在加载完成后暂停。

var m_main = b4w.require("main");
m_main.pause();

当你想再次启用它时。打电话

m_main.resume();

关于three.js - Blender 4 Web 即使在加载页面后也会不断消耗 CPU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43331360/

相关文章:

webgl - 是否有可用的 THREE.js API 文档?

javascript - Mesh 在 three.js 中突然消失了。剪裁?

camera - Three.js:地形上的相机碰撞

three.js,服装和形状键

python - blender - 如何为对象添加颜色?

javascript - 在 HTML5 Canvas 上添加按钮和控件

javascript - 为什么只显示波浪的顶部附近?我想显示它的整个

python - 如何让 Blender 导出器脚本从命令行运行?

JSON - Blender 和 ThreeJS - JSON 中位置 0 处出现意外标记 <

javascript - 在 Blender 249.2 中将 NIF 转换为 OBJ 会产生不可见对象