MarkGuk Posted April 21, 2016 Share Posted April 21, 2016 Ok, so have wrecked my brain with this issue and looking for some help. When using SeceneLoader.ImportMesh on a .STL I can only see 'grey' geometry coming in from the .STL file. The .STL file itself is attached to the forum issue. Code as follows: BABYLON.SceneLoader.ImportMesh("", "", "City.stl", scene, function (newMeshes) { city1 = newMeshes[0]; city1.position=new BABYLON.Vector3(25,10,0); city1.scaling=new BABYLON.Vector3(10,10,10); c1mat = new BABYLON.StandardMaterial("c1mat", scene); city1.material = c1mat; c1mat.diffuseColor = new BABYLON.Color3(1,0.5,1); }); Although I get my mesh imported perfectly none of the other properties seem to carry through e.g. Position/SCaling/Colors. Any help greatly appreciated. City.stl Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 21, 2016 Share Posted April 21, 2016 Hello, are you sure that your city is the first mesh in newMeshes array? Quote Link to comment Share on other sites More sharing options...
MarkGuk Posted April 21, 2016 Author Share Posted April 21, 2016 How would I check which item in the array it is? I tried ID[0],[1]&[2] ... had figured that the whole city would come in from the STL file as a single mesh... so hadn't expexted anymore than single figure ID's in my array? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 22, 2016 Share Posted April 22, 2016 just turn on the debug layer: scene.debugLayer.show() and check the meshes tree window Boz 1 Quote Link to comment Share on other sites More sharing options...
MarkGuk Posted April 23, 2016 Author Share Posted April 23, 2016 Debug layer on confirms that my 'city' geometry from the STL file does indeed import as a single Mesh. So as it's a single mesh I'd assume that it would be position [0] in any newMeshes array? Still not getting any colors or properties carried through with the STL import. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 23, 2016 Share Posted April 23, 2016 Ok sounds good! Now when I'm checking your file I see no colors inside. Quote Link to comment Share on other sites More sharing options...
MarkGuk Posted April 24, 2016 Author Share Posted April 24, 2016 Should there be colors defined within my STL? I thought the ASCII .STL didn't contain any colour info? Will have a play with some more STL's exported from different packages and see if I have any more luck. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 25, 2016 Share Posted April 25, 2016 I did'nt get your question then...I thought you wanted to get colors and position FROM the STL. Your STL only contains positions. So if you want the material to light it, you need to use emissiveColor instead of diffuseColor (because there is no normals in your file) 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.