chicagobob123 Posted May 21, 2016 Share Posted May 21, 2016 I am not clear. Are models always loaded directly to the scene? Can I get the models mesh and use it like a primitive? I want to apply the mesh to particles or take the geometry and apply different textures to it that are different colors. In my case, swapping textures to a container to indicate different vendors. The babylon format seems to include an entire scene from blender when all I want is the model. Am I understanding that correctly? Thanks Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 21, 2016 Share Posted May 21, 2016 Hi @chicagobob123 you are mostlikely using the scene importer, while you should be using the mesh importer if your file is a .babylon, see below code. assetName can be empty. //Variable('s) var container; //Import BABYLON.SceneLoader.ImportMesh("assetNameIfAny", "assetsFolder/", "myContainer.babylon", scene, function (newMeshes) { //Assuming your container is the first(or only) mesh/object in the file. container = newMeshes[0]; container.isVisible = false; }); //continue with instancing or copying & applying texture if it isn't already, //remember setting yourCopiedOrInstancedMesh.isVisible = true; or if you choose to use the original imported mesh in your scene aswell, you can remove the isVisible completely. gryff 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted May 21, 2016 Share Posted May 21, 2016 Bob, if you only want to import a specific mesh what @aWeirdo describes above is one way to do it. Other ways would be: 1. To delete lights, cameras etc and to export from Blender only the mesh you want. This will give you a couple of warnings in the log file telling you you don't have a light or camera - but the file will work. 2. To move lights and cameras etc to another layer. Then export only the layer with your mesh in it. Same warning as 1. Then you can use the method outlined by @JCPalmerin this thread cheers, gryff Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 21, 2016 Share Posted May 21, 2016 Both @aWeirdo and @gryff have useful methods and functions, however, when using .babylon scenes, I personally prefer BABYLON.SceneLoader.ImportMesh() for loading and mesh specific declarations in variables. DB Quote Link to comment Share on other sites More sharing options...
chicagobob123 Posted May 21, 2016 Author Share Posted May 21, 2016 Excellent ImportMesh it is then. Why is the scene an argument in this import, just trying to understand why or what's going on. Thanks Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 22, 2016 Share Posted May 22, 2016 @chicagobob123 - Don't look at the "scene" argument as the babylon scene engine - but as the scene file from which you are loading a specific mesh. Otherwise, how would you identify which .babylon scene file to load the mesh from? DB 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.