Forum

how to load 3d Object scene in Webpage

06 February 2019 11:09
Hello all,

In blend4web after deploying the project it is possible to create Interactive web scene in web page using HTML Coding , by accessing .json ,.js ,.css files of sample project.

Could you please give us any solution.



<!DOCTYPE html>
<html>
<head>
<script src="b4w.min.js"></script>
<script>
function hello() {
    var m_main = b4w.require("main");
    var m_data = b4w.require("data");

    var canvas_elem = document.getElementById("canvas_id");
    m_main.init(canvas_elem);
    m_data.load("sample.json");
	
}
</script>
</head>

<body onload="hello()"><canvas id="canvas_id"></canvas></body>

</html> 
06 February 2019 20:44
Maybe you should start by using the Project Manager and create a new project of the Copy type.

Now you get a new folder with an already functional scene, namely the B4W Default Cube. You can start from there - open the blend file (in the blender sub folder), make your scene, export it with the Export->B4W (JSON) option. You also have a javascript file for coding in the project's root folder. The manual describes how you can build, run, compile, and export your projects with the Project Manager.
 
Please register or log in to leave a reply.