Hi all,
Thanks for trying to help me…
@brianzinn
My current problem is that if you look at my way of loading the .glTF ( < babylon > … < / babylon > ), you will see that I do not have any other script in my HTML, and… I do not have the way to modify the scene (the canvas).
< babylon templates.main.params.fill-screen = “true” >
< model url=“models/vertical.gltf” ) >< scaling x=“1” y=“1” z=“1” >< / scaling>< / model >
< camera >< behaviors >< auto-rotate type=“1” >< /auto-rotate >< / behaviors >< / camera >
< / babylon >
So, what would be the most appropriate script to try to make the canvas transparent?
Note:
If I replace my current code:
< babylon > … < / babylon >
For this one another simpler:
var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true);
var createScene = function() {
var scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color3(0, 1, 0);
var camera = new BABYLON.ArcRotateCamera("Camera", 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0), scene);
camera.attachControl(canvas, true);
var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);
light.intensity = 0.7;
var materialforbox = new BABYLON.StandardMaterial("texture1", scene);
var box = BABYLON.Mesh.CreateBox("box", '3', scene);
box.material = materialforbox;
scene.clearColor = new BABYLON.Color4(0,0,0,0.0000000000000001);
return scene;
};
var scene = createScene();
engine.runRenderLoop(function() {
scene.render();
});
Yes I get a transparent canvas, but here I get a little lost and I do not know how to load my current glTF model.
See my modified line: scene.clearColor = new BABYLON.Color4(0,0,0,0.0000000000000001);
I’m very new to Babylon, sorry if something escapes me.
Any idea ?