Reputation: 2257
I have created a simple scene with a cube and a sphere using Blender. Exported it as Blender 4 web json. I have done a simple a simple webpage as follows.
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>
Above file is creating using these guidlines 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.
When i ran the above HTML(i have started a simple HTTP server in the directory containing the index.html using python), it's ok if the cpu goes high and comes down. But, the problem is this webpage keeps consuming constant amount(say 20%) of CPU. Why is CPU consumed even after a webpage is loaded. Do i need to disable anything in b4w to reduce the cpu usage when i'm not doing any action on webpage(Such as scrolling, clicking).
Upvotes: 3
Views: 299
Reputation: 2257
It consumes CPU Constantly because blender engine will keep running even when we are not interacting with the model.
Blender engine can be paused when not needed as follows. Blender engine can be paused after loading is done.
var m_main = b4w.require("main");
m_main.pause();
When you want to enable it again. call
m_main.resume();
Upvotes: 1
Reputation: 252
Try not to load that b4w.full.min.js file in the same page.
Explanation: The player already contains the b4w engine and it seems that the use of both is very intensive for the CPU.
Upvotes: 0