Jump to content

Blender export issue -texture


mattx264
 Share

Recommended Posts

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.

post-7568-0-47726500-1395512632_thumb.pn

post-7568-0-00706200-1395512659_thumb.pn

Link to comment
Share on other sites

 $(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) {     });

});
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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, 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...