AB95 Posted November 3, 2016 Share Posted November 3, 2016 Hi everybody, I am very new to both Blender and Babylon. Basically I am trying to load a scene exported from Blender and create a skybox afterward, the scene is nothing more than a default blender scene(the one consists of a box, camera and light, I load this scene just to make sure I hadn't added or modified anything in the scene that may leads to other issues once I export the scene into babylon file). I try to create a skybox after loading the scene, using code below: =============================================== var canvas; var engine; var scene; function initScene() { canvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(canvas, true); scene = new BABYLON.Scene(engine); BABYLON.SceneLoader.Load("babylon/","testScene.babylon",engine,function(newScene){ newScene.executeWhenReady(function(){ newScene.activeCamera.attachControl(canvas,false); var ground = BABYLON.Mesh.CreateGround("ground", 10, 10, 2, newScene); var skybox = BABYLON.Mesh.CreateBox("skyBox",1000.0,newScene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox",newScene); skyboxMaterial.backFaceCulling = false; skybox.infiniteDistance = true; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("images/skybox/cloudSkyBox/DaySkybox", newScene); skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE; skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0); skyboxMaterial.disableLighting = true; skybox.material = skyboxMaterial; engine.runRenderLoop(function(){ newScene.render(); }); }); },function(progress){}); } function initBB(){ if (BABYLON.Engine.isSupported()){ initScene(); }else{ console.log("not support BB"); } } document.addEventListener("DOMContentLoaded",initBB,false); document.addEventListener("resize",function(){ engine.resize(); }); =============================================== The blender scene "newScene" is loaded(I can see the box, a directional light of the blender default scene, I can use the free camera preset in blender scene), the ground mesh added into the newScene can be seen as well, but the skybox is not shown! There is no error message shown on the browser console, I had tried to google for similar problem but couldn't find the solution... I am not sure if I set up the blender scene wrongly before I export or there is other factor that cause this issue. Any help would be greatly appreciated! TestProject.zip Quote Link to comment Share on other sites More sharing options...
AB95 Posted November 3, 2016 Author Share Posted November 3, 2016 After some trial and error, I figured it out. I did not set the renderingGroupId of each of the meshes in scene properly, after setting them properly, I am able to see all of my meshes(including skybox). also, I did not set up my free camera in blender properly which its clipping value is set too high. Feel good to figure out the problem! Quote Link to comment Share on other sites More sharing options...
Théo Sabattié Posted November 3, 2016 Share Posted November 3, 2016 Hi' I tested your code, Your have to reduce the size of the skybox: var skybox = BABYLON.Mesh.CreateBox("skyBox", 1000.0, newScene); to var skybox = BABYLON.Mesh.CreateBox("skyBox", 50.0, newScene); and that work. AB95 1 Quote Link to comment Share on other sites More sharing options...
AB95 Posted November 3, 2016 Author Share Posted November 3, 2016 Yeah I set the skybox way too big compare with the camera maxZ setting, I figure out the problem of the skybox after I tweak around the renderingGroupId of the skybox as well as remaining meshes in the scene, thank you for helping me test my code Théo Sabattié 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.