Strange light problem

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
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Strange light problem

Post by Asimov »

Hi all,

I am having problem with lights.

Ok in my scene I have ambient light, and one spotlight, but I thought that some of my meshes seemed to be too light.
So as a test I turned off my spotlight and only left with ambient light. Now the scene goes dark as it is supposed to but my house meshes seem to be lit. They are not going dark.

In 3ds max I added a little specular and glossiness. Could this be causing it?

Here is my meshloading code. Bear in mind the room is loaded using the same function as the houses, and yet the houses light but the room doesn't.

Here is my meshloading code

Code: Select all

void LoadMesh::loadMesh(ISceneManager* smgr,IVideoDriver* driver,const wchar_t* modelname)
{
     mesh = smgr->getMesh(modelname);
    node = smgr->addMeshSceneNode(mesh);
    if (node)
    {
        node->setMaterialFlag(EMF_LIGHTING, true);
        node->setPosition(core::vector3df(0,0,0));
        node->addShadowVolumeSceneNode();
    }
}
 
And here is my light code. I have commented out the spotlight until I work out why you can see my houses in a dark room

Code: Select all

 smgr->setAmbientLight(SColor(255, 180, 180, 180));
    /*
    ILightSceneNode* mySpotLight = smgr->addLightSceneNode();
    mySpotLight->setPosition(vector3df(0.0f, 140.0f, 0.0f));
    mySpotLight->setRotation(vector3df(-90.0f, 0.0f, 0.0f));
     SLight spotLightData;
    spotLightData.Type = ELT_SPOT;
    spotLightData.OuterCone = 300;
    spotLightData.InnerCone = 100;
    mySpotLight->setLightData(spotLightData);
*/
 
Image
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Strange light problem

Post by Seven »

i had this issue before also... try reversing the lighting flag on the model (true with no lights, false with lights) and see what happens.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Strange light problem

Post by Asimov »

Hi Seven,

I did this, but it made no difference.
The difference between the room mesh and the house mesh is this. The room mesh has a material, but the house mesh just has the green added as a colour in 3ds max.
I wonder if that is the reason it is going wierd.

Also the room, table, and board have the uvs unwrapped properly, but the house doesn't.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Strange light problem

Post by Asimov »

Hi Seven,

I think I solved the problem.
In the material settings in 3ds max the ambient light was linked to the colour. First I unlinked it, and that did nothing different.

So I changed the ambient colour in the material in 3ds max to black, and now it solved the problem.

I think the problem didn't occur with the room mesh because I am loading a diffuse map, but the houses were not loading a map, so they were taking the ambient colour settings.
Post Reply