Я изучаю учебные пособия для babylonjs, и я вытягивал свои волосы поверх многих вещей. Я нахожусь в первом учебном пособии по окружающей среде, и я пытаюсь отобразить свой skybox. предполагая, что пути к файлам верны, какова может быть проблема?babylon skybox from hell
var canvas,
createScene,
engine;
// Get the canvas element from our HTML below
canvas = document.querySelector("#renderCanvas");
// Load the BABYLON 3D engine
engine = new BABYLON.Engine(canvas, true);
// Here begins a function that we will 'call' just after it's built
createScene = function() {
var scene = new BABYLON.Scene(engine);
// this is how to set or change the background color
// the .clearColor method is used with the new BABYLON.Color3();
scene.clearColor = new BABYLON.Color3(0.5, 0.8, 0.5);
// there are also preset colors like blue, red, yellow you can add by saying BABYLON.Color3.Blue();
// ambient color is used to help determine what things will ultimately look like.
scene.ambientColor = new BABYLON.Color3(0.3, 0.3, 0.3);
// when there is no ambient color on the scene, ambient colors on textures and ambient colors of your objects will have no effect.
var camera = new BABYLON.ArcRotateCamera("Camera", 0.4, 1.2, 20, new BABYLON.Vector3(-10, 0, 0), scene);
var light0 = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3.Zero(), scene);
light0.diffuse = new BABYLON.Color3(1, 1, 1);
light0.specular = new BABYLON.Color3(1, 1, 1);
light0.groundColor = new BABYLON.Color3(0, 0, 0);
// skybox
var skybox = BABYLON.Mesh.CreateBox('skyBox', 100.0, scene);
console.log(skybox);
var skyboxMaterial = new BABYLON.StandardMaterial('skyBox', scene);
skyboxMaterial.backFaceCulling = false;
skybox.material = skyboxMaterial;
// infanite distance makes the sky box follow the camera's position
skybox.infiniteDistance = true;
// here, we remove all light relection from the shape
skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
// now we apply the texture to the box
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture('data/images/skybox', scene);
skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
scene.activeCamera = camera;
scene.activeCamera.attachControl(canvas);
return scene;
}; // End of createScene function
// -------------------------------------------------------------
// Now, call the createScene function that you just finished creating
var scene;
scene = createScene();
// Register a render loop to repeatedly render the scene
engine.runRenderLoop(function() {
scene.render();
});
// Watch for browser/canvas resize events
window.addEventListener('resize', function() {
engine.resize();
});
Вы не говорите, в чем проблема. Пожалуйста, будьте ясны. Нечестно получить людей, которых вы не платите, чтобы догадаться, в чем проблема, или что происходит/не происходит. –
В чем проблема? ошибка? Вы проверили образцовый код детской площадки Babylon.js? http://www.babylonjs-playground.com?13 –
Gman, он не отображает все, что я могу сказать. Если бы я мог быть более конкретным, я бы это сделал. Я надеялся, что были такие вопиющие эксперты, как вы могли проверить. –