JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.babylonjs.com/babylon.js"></script>
<canvas id="canvas" />
CSS
html, body, #canvas {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
JavaScript
var engine = new BABYLON.Engine(document.getElementById('canvas'), true);
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.ArcRotateCamera('camera', 150, 0.8, 150, new BABYLON.Vector3(0, 0, 0), scene);
camera.mode = BABYLON.Camera.PERSPECTIVE_CAMERA;
camera.setPosition(new BABYLON.Vector3(0, 150, 700));
var material = new BABYLON.StandardMaterial("sm", scene);
var light = new BABYLON.SpotLight("light", new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(-1, -0.7, 0), 3, 3, scene);
// var light = new BABYLON.DirectionalLight("light", new BABYLON.Vector3(-1, 0, 0), scene);
light.diffuse = new BABYLON.Color3(1, 1, 1);
light.specular = new BABYLON.Color3(1, 1, 1);
var ground = BABYLON.Mesh.CreateGround('ground', 1000, 1000, 1, scene);
var box = BABYLON.Mesh.CreateBox("box", 200, scene);
box.material = material;
box.material.specularColor = new BABYLON.Color3(0, 0, 0);
box.position = new BABYLON.Vector3(-200, 100, 0);
var box2 = BABYLON.Mesh.CreateBox("box2", 50, scene);
box2.material = material;
box2.material.specularColor = new BABYLON.Color3(0, 0, 0);
box2.position = new BABYLON.Vector3(-450, 25, 0);
var box3 = box.clone();
box3.position = new BABYLON.Vector3(200, 100, 0);
var box4 = box2.clone();
box4.position = new BABYLON.Vector3(450, 25, 0);
scene.activeCamera.attachControl(canvas);
engine.runRenderLoop(function () {
scene.render();
});