Aerion Posted September 25, 2017 Author Share Posted September 25, 2017 @RaananW Why is it loading my textures but it's not loading ALL of my textures ON to the tree? It's only loading one. It should be loading a leaf texture with transparent background as well as the bark ON to my tree. And the background should be transparent, but it will most likely turn out light green because I'm not sure how to alpha out that part of the tree either using the MTL or otherwise. Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 25, 2017 Share Posted September 25, 2017 Your MTL file looks like this: # # Wavefront material file # Converted by Meshlab Group # newmtl material_0 Ka 0.200000 0.200000 0.200000 Kd 1.000000 1.000000 1.000000 Ks 1.000000 1.000000 1.000000 Tr 1.000000 illum 2 Ns 0.000000 There is no definition of a texture at all. Check your OBJ exporter and see why it doesn't export the materials Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 26, 2017 Author Share Posted September 26, 2017 @RaananW It's loading the correct MTL now with correct textures. But why is it showing the top of my tree as all white? And why when I try to position the TREE, is it positioning the leaves ONLY instead? http://babylontesting.epizy.com/ - Link to Demo Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 26, 2017 Share Posted September 26, 2017 Hi @Mythros, I am not sure if we see the same thing. Your MTL file is not 404: Also, when enabling offline support, make sure to set a new version when you upload a new file (in the manifest), otherwise the old file will always be loaded. Your questions are all valid, and we are all happy to help, but have you tried solving the problem yourself? What steps did you take to solve this? did you look in the playground? maybe found something interesting in the doc? Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 26, 2017 Author Share Posted September 26, 2017 @RaananWi used the console to try & solve this. but to no avail.. i just want my tree to display correctly.. nothing more, nothing less. Thank you so kindly for all the kind words. <3 Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 26, 2017 Author Share Posted September 26, 2017 @RaananW I have no idea how or where to fix that. Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 27, 2017 Share Posted September 27, 2017 I can only recommend to simplify the entire process and see if you can solve the specific problem. There is a lot going on in your script. Try isolating the problem, maybe just loading the OBJ file with a simple command. Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 28, 2017 Author Share Posted September 28, 2017 @RaananW Once again, I have tried that at : http://babylontesting.epizy.com & it didn't work... In the network tab you can CLEARLY see it LOADING all textures correctly. But why are the leaves on my tree invisible & why are they acting when positioned like they're not a part of the tree branch? How to fix? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 28, 2017 Share Posted September 28, 2017 Do you have a live repro we can check? Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 28, 2017 Author Share Posted September 28, 2017 @Deltakosh @RaananW I can make one. The website I posted above is live. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 28, 2017 Share Posted September 28, 2017 We need a simple version with a reference to babylon.max.js Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 28, 2017 Author Share Posted September 28, 2017 Ok @Deltakosh Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 29, 2017 Author Share Posted September 29, 2017 Edited Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 29, 2017 Share Posted September 29, 2017 It would also be great if you remove the offline support. About the current state that I see - you have two meshes in your scene, one for branches, and one for leaves (or at least that'S what their names state). I wouldn't expect the leaves to have a single mesh, but I guess this is your plan. Both meshes are the same size. The leaf mesh is not visible, but I don't know if it is because the mesh object is empty, or that the offline support prevents the user from downloading the updated OBJ file. Make sure the OBJ is being exported correctly. Try loading it in a different application and see if it works. Quote Link to comment Share on other sites More sharing options...
adam Posted September 29, 2017 Share Posted September 29, 2017 2 hours ago, Mythros said: @Deltakosh @RaananW I spent hours getting this to be as small, efficient & easy as possible. http://babylontesting.epizy.com/loadentity/ Here's a link to the zip : http://babylontesting.epizy.com/loadentity/loadentity.zip I hope this helps! A few things I noticed: You are creating 2 asset managers. You have a loadEntity function that doesn't get used. You have 2 render loops. GameMonetize and Aerion 2 Quote Link to comment Share on other sites More sharing options...
gryff Posted September 29, 2017 Share Posted September 29, 2017 Well I'm not sure how much I can contribute to this thread - but I will try I've been playing with the .glTF format and found that I could load them in the Sandbox - so I thought I would try with @Mythros's .obj files. But first I imported them into Blender and re-exported as a .babylon file. That .babylon file worked fine in the Sandbox. So now I re-exported them from Blender as an .obj file and loaded the .obj file into the Sandbox and I got the result in image 1 (upper) - just the tree trunk. but the materials were present. So I started to make changes. First, in the leaf material, I changed the the value labelled as "alpha" from 0 ->1. The result, I could now see the "leaves" but extraneous stuff filled up all the planes - so no transparency I then scrolled down to the texture that was being used and looked at the "hasAlpha" value - Image 2(upper) which said "false" and changed that to 1. Result - tree was showing fine (Image 2 bottom) I went back to the babylon file I had created and look at the material parameters. {"name":"tree1.Mat17310","id":"tree1.Mat17310","ambient":[0.8,0.8,0.8],"diffuse":[0.64,0.64,0.64],"specular":[0.25,0.25,0.25],"emissive":[0,0,0],"specularPower":50,"alpha":1, "backFaceCulling":true,"checkReadyOnlyOnce":false,"maxSimultaneousLights":4, "diffuseTexture":{"name":"English_Oak_diffuse.png","level":1,"hasAlpha":1,"coordinatesMode":0,"uOffset":0,"vOffset":0,"uScale":1,"vScale":1,"uAng":0,"vAng":0,"wAng":0,"wrapU":1,"wrapV":1,"coordinatesIndex":0}}, NOTE the value for"alpha (line1) and "hasAlpha" (last line). I also tried to load @Mythros's original files into the Sandbox - they did not work. The leaves mesh was visible - but both the trunk and the leaves meshes both had a standard material. The Sandbox seemed to be ignoring the .mtl file. Examining the original .obj file I found this mtllib ./models/deciduous/01/deciduous01/deciduous01.mtl Changing that line to : mtllib deciduous01.mtl and it loaded and behaved just like my .obj export from Blender did. I'm not sure if this helps @RaananW, or @Deltakosh or @Mythros in figuring out the problem. Or did I just add more confusion? cheers, gryff brianzinn and Aerion 1 1 Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 29, 2017 Author Share Posted September 29, 2017 how do I do this? Quote Link to comment Share on other sites More sharing options...
Aerion Posted September 29, 2017 Author Share Posted September 29, 2017 hi, @gryff @Deltakosh @RaananW I need my tree model to be imported as OBJ in a CORRECT way WITH the transparency on the leaves & the leaves showing up. i just tried the blender babylon exporter, it froze on me when trying to export. i'd rather my obj file load correctly with everything intact as one single obj file. thank you <3 Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 1, 2017 Author Share Posted October 1, 2017 anyone? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 1, 2017 Share Posted October 1, 2017 The mtl file is still wrong: newmtl Mat59410 Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.640000 0.640000 0.640000 Ks 0.250000 0.250000 0.250000 Ke 0.000000 0.000000 0.000000 Ni -1.000000 d 0.000000 As you can see d 0.000000 means alpha will be 0 so fully transparent explaining why you do not see your leaves. Replace it with 1.000000 to ensures only alpha test kicks in. Also, backface culling is turned on in the leaves but this part of the geometry should probably be visible from both side. You should turn backface culling off after loading on this material. Aerion 1 Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 1, 2017 Author Share Posted October 1, 2017 @Sebavan how do i turn off backface culling? Quote Link to comment Share on other sites More sharing options...
JohnK Posted October 1, 2017 Share Posted October 1, 2017 Just now, Mythros said: @Sebavan how do i turn off backface culling? Interestingly I found the answer by doing a search for backfaceculling in the questions and answers section of this forum and it was in the code of the first post of the following thread which you have posted in just change the false to true. Aerion 1 Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 1, 2017 Author Share Posted October 1, 2017 @Sebavan @JohnK Thank you! I've got 2 more small issues with it not loading correctly, then I will mark this as solved. In the pic I uploaded, my leaf texture is only showing half the side of the leaf on each plane of the tree, how to fix? The texture ITSELF is fine. I have circled the problem in Red. 2ndly, how do I remove the shine? I have circled the problem in black. Thank you all SO much! <3 Source code removed Thank you again! <3 ~Mythros Quote Link to comment Share on other sites More sharing options...
Aerion Posted October 1, 2017 Author Share Posted October 1, 2017 Here are the textures themselves along WITH the MTL which I THINK NOW is correct. NOTE : The MTL is at the bottom of this post. deciduous01.mtl Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 2, 2017 Share Posted October 2, 2017 after loading in the callback: // Decrease specular or what is called shine in the thread: scene.getMaterialByName("Mat5944").specularColor = BABYLON.Color3.Black(); // Disable culling or what is called seeing half the leaves in the thread: scene.getMaterialByName("Mat59410").backFaceCulling = false; Aerion 1 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.