Jump to content

OBJ loaders and illumination


Sophie C
 Share

Recommended Posts

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? 

Link to comment
Share on other sites

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.

32.png.379f3cf5c15023ec58a89afea58cdbb3.png

32.png

Link to comment
Share on other sites

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! 

Link to comment
Share on other sites

@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 :)

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...