(function(){
var canvas = document.getElementById("canvas_3d");
var engine = new BABYLON.Engine(canvas, true);
scene = createScene(engine, canvas);
engine.runRenderLoop(function () {
scene.render();
});
})()
function createScene(engine, canvas) {
var scene = new BABYLON.Scene(engine);
//Here we tell our canvas to be transparent, so we can see the HTML background
scene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
var lightHemi = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3(0, 10, 10), scene);
var sun = new BABYLON.PointLight("Sunshine", new BABYLON.Vector3(20, 100, 2), scene);
var box = BABYLON.Mesh.CreateBox("Box", 3, scene);
box.position = new BABYLON.Vector3(4, 0, 0);
var sphere = BABYLON.Mesh.CreateSphere("Sphere", 12, 3, scene);
var targetCam = new BABYLON.Vector3(0, 0, 0);
var orbitalCamera = new BABYLON.ArcRotateCamera("CameraOrbit", 1.57, 1.57, 10, targetCam, scene);
scene.activeCamera.attachControl(canvas);
//Here is the faulty line, comment this one to see lovely transparency on canvas
var fxaa = new BABYLON.FxaaPostProcess("fxaa", 1.0, orbitalCamera, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, engine, true);
//the following line appears to be not needed to activate the AAf, you can de-comment or not, no effect on AAf nor transparency)
//orbitalCamera.attachPostProcess(fxaa);
return scene;
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.