H all,
The real problem with my houses was the lighting.
Ok here is the problem. Originally in this scene I was using a spotlight, and my houses looked fine as objs.
I used this code for my lighting.
Code: Select all
smgr->setAmbientLight(SColor(0, 255, 255, 255));
ILightSceneNode* mySpotLight = smgr->addLightSceneNode();
mySpotLight->setPosition(vector3df(0.0f, 145.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);
but the room was a bit dark, and no matter what I did with the above settings I couldn't make the room lighter.
So I changed my light settings to this.
Code: Select all
smgr->setAmbientLight(SColor(0, 255, 255, 255));
ILightSceneNode* Light = smgr->addLightSceneNode();
Light->setPosition(vector3df(0.0f, 250.0f, 0.0f));
SLight lightData;
lightData.Type= ELT_POINT;
Light->setLightData(lightData);
Light->setRadius(150);
Light->getLightData().Attenuation = vector3df(0,0,.001);
And the room looked great, the board looked great and my hand grenade looked great (even though the grenade won't be in the game and is only there as a test
3d object), but my houses went black.
I thought the houses going black was a problem with ambient, but no my houses stayed black no matter what I set the ambient to in max.
So then I tried to load in my houses using the x format. Instead of being black they kept coming out white, and no matter what I did they were always white.
Then I attached a green tga to them and only then they went green, but that was no good. They seemed to be green but with a flat shading. There was no tone
and I couldn't see the apex of the rooves.
So then I tried something off the wall and left both lights in the scene. Like this.
Code: Select all
smgr->setAmbientLight(SColor(0, 255, 255, 255));
ILightSceneNode* Light = smgr->addLightSceneNode();
Light->setPosition(vector3df(0.0f, 250.0f, 0.0f));
SLight lightData;
lightData.Type= ELT_POINT;
Light->setLightData(lightData);
Light->setRadius(150);
Light->getLightData().Attenuation = vector3df(0,0,.001);
ILightSceneNode* mySpotLight = smgr->addLightSceneNode();
mySpotLight->setPosition(vector3df(0.0f, 145.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);
Then I got my brighter room, and green houses. Bear in mind they still come out white if I use the x format no matter what the lighting.
The question I need to ask is why my houses should turn black when I use the second light settings on their own. Bear in mind nothing else in the scene
turned black, just the houses. Unless you are not allowed to the spotlight on it's own in a scene?
There is one more annoyance. Occasionally with the two lights when I rotate the scene I get a strange crosshatching effects momentarily, probably a directx thing.
I have been doing 3D for a long time, and I know everything about lights in max, but the lighting in irrlicht does not seem to have any logic to it.
I have used other engines and it is quite easly to set up lighting, but I have never come across a problem where lighting causes a model to change to black at all, unless it was night time of course LOL.
What really annoys me is that I haven't really worked out why it didn't work, and it works with this new setup. So what really annoys me is that I haven't learnt anything.