Problem with simple light

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
STTrife
Posts: 33
Joined: Sun Jan 13, 2013 3:43 pm

Problem with simple light

Post by STTrife »

Hi there,

I'm having a problem with a simple light, at least I think there is a problem.

First, I have a terrain with simple material:

Code: Select all

Material.Lighting = true;
Material.setTexture(0, mgr->getVideoDriver()->getTexture("dirt.jpg"));
Material.GouraudShading=true;
Material.FogEnable=true;
Then I set up ambient light, fog and a simple light:

Code: Select all

driver->setFog(fogcolor,video::EFT_FOG_LINEAR,
ILightSceneNode * lightnode = 
smgr->addLightSceneNode (   smgr->getRootSceneNode(),
                        vector3df(200, height+500, 200),
                        SColorf(173.f / 255.0f, 81.f/255.f, 51.f/255.f, 0.1 ), 100);
smgr->setAmbientLight(SColor(255,70,40,20));
Now the problem is that the attenuation of the light doesn't seem to work. Everything in the radius of the light is fully lit, everything outside the radius is only lit by ambient light. so the light has extremely hard edges on the radius, and it's not a gradual lighting where the center is brightest and the the further away, the less light..

I have no idea what causes this. Anyone can help with this? If you want I can provide a sceenshot.

edit: maybe it doesn't matter, but I do use vbo's (hardware hint to static)

thanks a lot!
mss
Posts: 24
Joined: Mon Oct 29, 2012 6:41 pm

Re: Problem with simple light

Post by mss »

Check your mesh normals. Have you done a scale on the mesh? If you have, your normals have gone bad and need recalculating. I had this problem too. Some meshes (I didn't scale) were fine, others (that I did scale) were awful.
Post Reply