// This creates a basic Babylon Scene object (non-mesh)
scene = new BABYLON.Scene(engine);
engine.runRenderLoop(function () {
scene.render();
if (captureFrame) {
var im = document.getElementById("genEnvMap");
im.src = canvas.toDataURL();
captureFrame = false;
}
});
// This creates and positions a free camera (non-mesh)
camera = new BABYLON.ArcRotateCamera("camera1",3,3,3, new BABYLON.Vector3(0, 0, -0), scene);
camera.minZ = 0;
// This targets the camera to scene origin
camera.setTarget(new BABYLON.Vector3(0, 0,0));
camera.speed = 170;
// This attaches the camera to the canvas
camera.attachControl(canvas, true);
SceneBuilder(scene);
return scene;
};
// make your scene here
function SceneBuilder(scene){
var box = BABYLON.MeshBuilder.CreateSphere("Sphere", 100.0, scene, true);
var mat = new BABYLON.CustomMaterial("skyBox", scene);
mat.diffuseTexture = new BABYLON.Texture("https://upload.wikimedia.org/wikipedia/commons/e/ea/Equirectangular-projection.jpg", scene );
mat.Fragment_Before_FragColor(' color = vec4( texture2D(diffuseSampler,-1.*vDiffuseUV).rgb,1.);')
box.material = mat;
}