mattx264 Posted March 22, 2014 Share Posted March 22, 2014 Hi,First I created house model in autocad and i cut it to pieces (every floor is one pieces) and exported to obj, next imported to blender and exported to babalon. when i loading one scen (one floor) texture are OK, but when i load next scene (next floor) texture mixing, every next scene makes more mixing. this is my loading code BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "09reszta.babylon", scene, function (newMeshes) {}); BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "03pietrobezmebli.babylon", scene, function (newMeshes) { });Thank for help. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2014 Share Posted March 22, 2014 Can you show the complete code for BABYLON.SceneLoader.ImportMesh Quote Link to comment Share on other sites More sharing options...
mattx264 Posted March 22, 2014 Author Share Posted March 22, 2014 $(document).ready(function () { if (!BABYLON.Engine.isSupported()) { alert("Your browser does not support WebGL so you can't use BabylonJS on it"); return; } var canvas = $("#renderCanvas")[0]; var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 0, BABYLON.Vector3.Zero(), scene); var light0 = new BABYLON.HemisphericLight("Hemi0", new BABYLON.Vector3(0, 1, 0), scene); camera.setPosition(new BABYLON.Vector3(-40, 40, 0)); camera.attachControl(canvas); 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 > 200) camera.radius = 200; if (camera.radius < 5) camera.radius = 5; }; camera.attachControl(canvas); scene.registerBeforeRender(beforeRenderFunction); engine.runRenderLoop(function () { scene.render(); }); var skybox = BABYLON.Mesh.CreateBox("skyBox", 1000.0, scene); var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene); skyboxMaterial.backFaceCulling = false; skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("../Content/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; var extraGround = BABYLON.Mesh.CreateGround("extraGround", 1000, 1000, 1, scene, false); var extraGroundMaterial = new BABYLON.StandardMaterial("extraGround", scene); extraGroundMaterial.diffuseTexture = new BABYLON.Texture("../Content/House/grass.jpg", scene); extraGroundMaterial.diffuseTexture.uScale = 60; extraGroundMaterial.diffuseTexture.vScale = 60; extraGround.position.y = -2.05; extraGround.material = extraGroundMaterial; //BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "05reszta.babylon", scene, function (newMeshes, particleSystems) { }); //BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "01piwnicabezmebli.babylon", scene, function (newMeshes, particleSystems) { }); //BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "02parterbezmebli.babylon", scene, function (newMeshes, particleSystems) { }); BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "03pietrobezmebli.babylon", scene, function (newMeshes, particleSystems) { }); //BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "04pietrobezmebli.babylon", scene, function (newMeshes, particleSystems) {}); BABYLON.SceneLoader.ImportMesh("", "../Content/Home3d/", "09reszta.babylon", scene, function (newMeshes, particleSystems) { });}); webGLmmk 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2014 Share Posted March 22, 2014 Why you cut your pieces? If load you a single models without cutting in autocad, what result do you have? I think that your problem is located at the level of model. may be that the textures are missing. Quote Link to comment Share on other sites More sharing options...
mattx264 Posted March 22, 2014 Author Share Posted March 22, 2014 1. I cut model because i could find easy way to make floors visible/hide. When import model to blender i got hundreds mesh, so i I decided to cut model.2. When i load SINGLE model every think is OK, but i can not work with floors. "may be that the textures are missing." i don't get any error. Before I cut model in autocad i had try grouping and this is result http://tinypic.com/r/2np2tg/8 thank you for help Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 22, 2014 Share Posted March 22, 2014 Have you tried your model (without cutting) in blender or 3ds max if you have it or other than autocad.The problem lies on your model. This does not come from babylon. I think that the problem is surely because of the cut. Quote Link to comment Share on other sites More sharing options...
Temechon Posted March 23, 2014 Share Posted March 23, 2014 Hello, I think I know this problem... When your scene is imported in blender and then exported in babylon format, all materials name are generated by blender. It is thus possible that your two scenes have several material with the same name, causing this issue. You have 2 solutions here : - Merge your two scenes into one big scene- Be sure to rename all your materials in Blender in your two scenes : all materials should have a different name. Cheers, gwenael 1 Quote Link to comment Share on other sites More sharing options...
mattx264 Posted March 23, 2014 Author Share Posted March 23, 2014 I think @Temechon is right, - Merge your two scenes into one big scene : how can i do it ?, is it possible to do it in code ? thanks Quote Link to comment Share on other sites More sharing options...
Temechon Posted March 24, 2014 Share Posted March 24, 2014 No, it is not possible in code, you have to merge all your meshes in blender to have only one babylon file. But I still think the easiest way to solve this is to rename all materials in your blender scenes. 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.