Page 1 of 1

Help with lighting

Posted: Wed Sep 30, 2009 11:22 am
by Chet
The model on my terrain is much darker than the terrain and the smaller details don't cast shadows so it looks flat, what am I missing here in settings?

Code: Select all

smgr->setAmbientLight(video::SColorf(.3f,.3f,.4f,1.0f)); 
scene::ILightSceneNode* nodeLight = smgr->addLightSceneNode(0, core::vector3df(100, 100, 100),
      video::SColorf(1.0f,1.0f,1.0f,1.0f),
      20000.0f);
video::SLight light;   
light.Direction = core::vector3df(1000,100,1000);
light.Type = video::ELT_DIRECTIONAL;
light.AmbientColor = video::SColorf(0.3f,0.3f,0.4f,1);
light.SpecularColor= video::SColorf(0.4f,0.4f,0.5f,1);
light.DiffuseColor = video::SColorf(1.0f,1.0f,1.0f,1);
light.CastShadows = true;

scene::ISceneNode * temple = smgr->addMeshSceneNode(smgr->getMesh("E:/ALLNEW/Epothy/temple/000_mesh.x"));
             temple->setPosition(core::vector3df(512,26.5,512));
          //   temple->setScale(core::vector3df(20,20,20));
             temple->setMaterialFlag(video::EMF_LIGHTING, false);
             temple->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);        

Posted: Wed Sep 30, 2009 12:31 pm
by Xarshi
Well, for starts, you are disabling light on the temple scene node. The line temple->setMaterialFlag(video::EMF_LIGHTING, false); turns off all light. Perhaps your terrain has lighting enabled? Just a thought.

Posted: Wed Sep 30, 2009 1:50 pm
by Chet
oh geeze, facepalm :P