var CreateHeightMapTestScene = function (engine) { var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene); var sun = new BABYLON.PointLight("Omni0", new BABYLON.Vector3(60, 100, 10), scene); camera.setPosition(new BABYLON.Vector3(-20, 20, 0)); // Skybox var skybox = BABYLON.Mesh.CreateBox("skyBox", 100.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("Scenes/Customs/skybox/skybox", scene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skybox.material = skyboxMaterial; // Ground var ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", "Scenes/Customs/heightMap.png", 100, 100, 100, 0, 10, scene, false); var groundMaterial = new BABYLON.StandardMaterial("ground", scene); groundMaterial.diffuseTexture = new BABYLON.Texture("Scenes/Customs/ground.jpg", scene); groundMaterial.diffuseTexture.uScale = 6; groundMaterial.diffuseTexture.vScale = 6; groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0); ground.position.y = -2.05; ground.material = groundMaterial; var beforeRenderFunction = function() { // Camera if (camera.beta < 0.1) camera.beta = 0.1; else if (camera.beta > (Math.PI / 2) * 0.9) camera.beta = (Math.PI / 2) * 0.9; if (camera.radius > 30) camera.radius = 30; if (camera.radius < 5) camera.radius = 5; }; scene.registerBeforeRender(beforeRenderFunction); return scene; };