setAmbientLight and .obj files

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
netkoji
Posts: 10
Joined: Sun Feb 01, 2009 1:32 pm

setAmbientLight and .obj files

Post by netkoji »

Hello everyone,

I'm currently fighting with ISceneManager::setAmbientLight() function and for some reason it does not seem to have any effect on meshes that are stored as Maya3D obj files. I tested it with the example Sydney md2 model and it works just fine but the same code for .obj file has no effect (i.e. the mesh is completely black no matter what values I set for the ambient light).

Am I missing something here? The mtl file is in place and is read successfuly, same for the texture file. Is there no support for ambient lights on obj meshes or am I simply required to make some kind of a function call?


Thanks!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

There had been some normals problems with obj files some time ago. Just be sure you export the normals in your .obj file, otherwise lighting won't work.
netkoji
Posts: 10
Joined: Sun Feb 01, 2009 1:32 pm

Post by netkoji »

The thing is that lightning DOES work and all normals are exported. It's just the setAmbientLight function that doesn't have any effect on the mesh.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Try creating an ILightSceneNode and setting its ambient light value.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe your ambient material settings are wrong. If you have an ambient material of black it won't give any result whatever ambient light you define.
netkoji
Posts: 10
Joined: Sun Feb 01, 2009 1:32 pm

Post by netkoji »

Ducky: This is the solution that I'm currently using but the effects are not satisfactory. Certain areas of the mesh, where the light doesn't reach, are completely black (which should not be the case given that ambient light is non zero).

hybrid: Do you mean material settings in the .mtl file or a material object in the actual code?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Both, or at least the one you're using.
Post Reply