Sophie C Posted July 25, 2017 Share Posted July 25, 2017 I have encountered a problem with the lighting of my imported obj. Testing models (both lambert and phong materials) both have the same effect: my lighting doesn't work on the loaded models, but works perfectly fine on the default spheres. Directional lights don't work at all (they might as well not exist) and hemisphere lights make a minimal difference on the brightness of the model. I'm not exactly sure if this is a bug, because I read that in the documentation, it states that the obj loader does not support illumination. If that's the problem, then well, does anyone know of a workaround? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 25, 2017 Share Posted July 25, 2017 Hey! we do not support loading lights but if you already have lights in your scene then it should work can you ensure that there are normals for your object in your .obj file? if not you can ask babylon to create them for you: mesh.createNormals() Quote Link to comment Share on other sites More sharing options...
Sophie C Posted July 26, 2017 Author Share Posted July 26, 2017 Thank you for the quick reply! I do not have to load lights, fortunately. I'm making a hemispheric light, spotlight, and four separate directional lights for the scene in the js file. While experimenting yesterday, the hemispheric and spotlight has some limited effect on the model, but does not do as much as I want (an intensity of 10000 will not so much as lighten the model a few shades up, while on a sphere it will whiten the whole thing). However, after creating normals like in your recommendation, it doesn't seem like it is the problem. The following image is of my screen after all lights are enabled. The model is a simple rod created in Maya, of a default phong material, compared to the default Babylon material and sphere. The effect seems to be the same as before. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 27, 2017 Share Posted July 27, 2017 Can you share your babylon file? Quote Link to comment Share on other sites More sharing options...
Sophie C Posted July 27, 2017 Author Share Posted July 27, 2017 I'm not using a .babylon file, I'm using a .obj. You can see the associated obj and mtl file here: rod.obj rod.mtl Also, it reoccurs with every obj file I have. base.mtl base.obj Quote Link to comment Share on other sites More sharing options...
Sophie C Posted July 27, 2017 Author Share Posted July 27, 2017 Ok, update. After playing around with Maya and downloading blender, I just think that Maya's exporting of the phong texture doesn't really translate well. However, typical lambert works (and the original model that I was dealing with had an unusually dark texture). I wouldn't say that my issue is 100% fixed due to the metals issue but as far as this goes, it's doing ok for me! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 27, 2017 Share Posted July 27, 2017 Lol so this is fine to me as well Sophie C 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted July 27, 2017 Share Posted July 27, 2017 @Sophie C Hi and welcome to the forum On 2017-07-26 at 2:22 PM, Sophie C said: I do not have to load lights, fortunately. I'm making a hemispheric light, spotlight, and four separate directional lights for the scene in the js file. Well that is 6 lights - I think the default value is 4 with the first two you created being dropped . You might want to increase the number of lights allowed to 8. Link Scroll down to limitations. And as you seem to have found out the diffuseColor and specularColor in your .obj file are ""diffuse":[0.5,0.5,0.5],"specular":[0.5,0.5,0.5]," as opposed to the default values for the Standard Material that will come with the sphere of " "diffuse":[1,1,1],"specular":[1,1,1]," You also appear to say that the rod has a "metal" type texture - you might want to look at this tutorial on PBR materials and this demo cheers, gryff Quote Link to comment Share on other sites More sharing options...
Sophie C Posted July 27, 2017 Author Share Posted July 27, 2017 Thank you so much for the reply! (Especially considering that these are such newbie problems.) I'll keep that in mind for the next time, thanks!! 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.