Models are all White but not

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:

Models are all White but not

Post by Asimov »

Hi all,

I found an old thread on here about whte models in 2005, and I am having the same problem, but it is strange.
Because I am using the x format on all my models I thought I would use the same format on my houses.

Now because my houses have only a green colour applied in max I saw no reason to add a texture map.
So when I import it into irrlicht I get white houses, no matter what the light settings are, and I have tried them all LOL.

However if I do this node->setMaterialFlag(EMF_LIGHTING,false); my houses suddenly are the correct colour.
However I don't want to have the models not receieving light.

Ok the other thing I tried is this. I load a very small green texture on to the houses and load that into irrlicht.
Yes the houses come out green, but it is still like they are not recieving light properly as they don't seem to have any light contour.
I might as well have square boxes there instead of houses, as there is not change in light on the surface.

I have tried low ambient in max, I have tried max ambient in max. I have tried no amibent , no gloss, and everything under ths sun, and the houses always come out white.
Or if I add a texture it is like there is no shader applied.

In the picture attached left is what I am getting al the time, and right is the test by applying a green texture map to the house, but it looks all washed out and crap.
Image
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Models are all White but not

Post by Asimov »

Hi all,

I have given up on the x format for the houses and exported them in obj and now they are green.
It is a shame as I wanted to use the same format for every model, but it is the only way to get my green houses grr.

Edit: ignore this post, I found out the real problem. Will post very soon. Well I found out the real problem, but it is a puzzle.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Models are all White but not

Post by Asimov »

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);
Image

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);
Image

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.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Models are all White but not

Post by mongoose7 »

I think you should remove ambient if you are doing lighting. In any case, it produces flat shading. Black objects may mean a problem with normals. Perhaps you are not learning anything because you are not in control of your scene?
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Models are all White but not

Post by Asimov »

Hi mongoose,

Even with lighting if I set ambient to 0 some objects will appear black, so I need the ambient, and yes I am not in control of my scene, I am playing with it until it is right.
With both lights on it looks pretty good now, but I wish I could fine tune things better. It seems a chore to get models to look right in the engine.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Models are all White but not

Post by mongoose7 »

If objects appear black, you should fix that and not turn on ambient. Only turn on a little ambient for faux global illumination when your scene is fixed.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Models are all White but not

Post by hendu »

The fixed-function lighting is per-vertex. If your house has low tessellation, that could contribute some.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Models are all White but not

Post by Asimov »

@Mongoose:
If objects appear black, you should fix that and not turn on ambient. Only turn on a little ambient for faux global illumination when your scene is fixed.
I totally agree, which is why I said I haven't learnt anything. The problem is that I don't know how to fix them. Whatever I set ambient lighting to in max, they always appear black, unless I turn on ambient lighting. I will do more tests obviously, but at the moment I don't know what is wrong, which makes me unhappy heh heh.

@Hendu:
The fixed-function lighting is per-vertex. If your house has low tessellation, that could contribute some.
All my models are built in quads, which is really 2 tris, so I wouldn't have thought tessellation could be the problem.

If I leave the 2 lights in the scene and I turn off ambient lighting I get this.
Image

If I turn off my spot light, and just leave the standard light with no ambient I get this.
Image

If I turn on ambient lighting and just have my spotlight I get this
Image

If I turn on ambient, and spotlight and the other light I get this
Image

Which I am quite happy with actually, but I would like to know why it is not working without ambient light for future projects.
Also that strange crosshatching bug can be seen on the walls in the first picture. I didn't realise that when I saved the screenshot that it captured it, but it did. My normalmaps look nice though LOL.
This bug usually happens when you rotate the scene.

Also if there was a problem with tessellation surely it would do the same thing no matter how many lights are in the scene.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Models are all White but not

Post by mongoose7 »

The first picture shows a problem with the board. Why don't you see if you can fix that.
Post Reply