lingkernyurk. Posted October 19, 2017 Share Posted October 19, 2017 (edited) I am a beginer of babylon.js. I was going to load obj file using babylon.objfileloader, but did't work alpha channel and transparency in loading obj.file. The code I worked is follow var loader = new BABYLON.AssetsManager(scene); BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true; var mesh; mesh = loader.addMeshTask("bane", "", "Assets/Chicken Coop/", id + ".obj"); obj file works well in assimpView, but don't work in babylon.js Here is result by babylon.js I believe you to help me. best regards. Edited October 19, 2017 by lingkernyurk. lingkernyuri Quote Link to comment Share on other sites More sharing options...
lingkernyurk. Posted October 19, 2017 Author Share Posted October 19, 2017 would you help me? Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 19, 2017 Share Posted October 19, 2017 Could be the way the file was exported. Can you show the associated mtl file? Quote Link to comment Share on other sites More sharing options...
javalang Posted October 19, 2017 Share Posted October 19, 2017 hi, maybe you have a similar issue I had in this thread. I'm pretty sure the materials.hasAlpha flag isn't set to true... Quote Link to comment Share on other sites More sharing options...
lingkernyurk. Posted October 20, 2017 Author Share Posted October 20, 2017 Hi RaananW Thanks for you replay. I send you my file.My file.zip. I believe you have a capacity to help me. Best regards Quote Link to comment Share on other sites More sharing options...
lingkernyurk. Posted October 20, 2017 Author Share Posted October 20, 2017 Hi javalang Thanks your reply. I did work as you said, but it don't work well. Send my code. mesh = loader.addMeshTask("bane", "", "Assets/"+ type +"/", id + ".obj"); mesh.onSuccess = function (task) { allMesh = task.loadedMeshes; for(i=0; i<task.loadedMeshes.length;i++) { allMesh.material.diffuseTexture.hasAlpha = true; } I believe you can help me.! Waiting for your reply. Quote Link to comment Share on other sites More sharing options...
javalang Posted October 21, 2017 Share Posted October 21, 2017 I wasn't able to load your file into the sandbox, I think there is some mismatch in the obj-file. What I did: importing into blender and exporting it to test.babylon with "Texture location"-option is set to "inline" for enbedding all textures. No special code required to render the file. Hint for loading objects in general: first make sure the import into http://sandbox.babylonjs.com/ is correct, after then your programmatically import will also be fine in the attachment you can find my converted .babylon file. Hope this helps. test.babylon 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.