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
ghiboz
Posts: 37
Joined: Tue Jan 15, 2008 12:09 pm
Location: Centallo (I)
Contact:

light problem

Post by ghiboz »

hi all!
i have this problem in my project.
i create a plane

Code: Select all

scene::ISceneNode* ground;
ground = Smgr->addCubeSceneNode(1);
ground->setScale(irr::core::vector3df(4,0.01f,4));
ground->setMaterialFlag(video::EMF_LIGHTING, false);
ground->setPosition( core::vector3df(0.0f, -1.0f, 0.0f));
I add a light and a billboard to show the lightpoint:

Code: Select all

scene::ISceneNode* node = 0;

// create light
node = Smgr->addLightSceneNode(0, core::vector3df(0,0,0),
	video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 1200.0f);
scene::ISceneNodeAnimator* anim = 0;
anim = Smgr->createFlyCircleAnimator (core::vector3df(0,0,0),20.0f);
node->addAnimator(anim);
anim->drop();

// attach billboard to light
node = Smgr->addBillboardSceneNode(node, core::dimension2d<f32>(1, 1));
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
node->setMaterialTexture(0, Driver->getTexture("particlewhite.bmp"));
my problem is that I see the plane all white, seems that there's a scene light that have a white light... what's my problem??

thanks in advance!
night_hawk
Posts: 153
Joined: Mon Mar 03, 2008 8:42 am
Location: Suceava - Romania
Contact:

Post by night_hawk »

Well, your box (ground) is not textured. Thus, it's drawn white. That pretty much seems the problem. Give it a texture!
ghiboz
Posts: 37
Joined: Tue Jan 15, 2008 12:09 pm
Location: Centallo (I)
Contact:

Post by ghiboz »

night_hawk wrote:Well, your box (ground) is not textured. Thus, it's drawn white. That pretty much seems the problem. Give it a texture!
thanks, i've added this:

Code: Select all

ground->setMaterialTexture(0, Driver->getTexture("detailmap3.jpg")); 
but is the samething (except that now the ground has a texture and isn't white..)
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

do you want the node to be using the light you added? Shoulsnt you use

node->setMaterialFlag(video::EMF_LIGHTING, true); //enable light

Or did i misunderstand you maybe.
ghiboz
Posts: 37
Joined: Tue Jan 15, 2008 12:09 pm
Location: Centallo (I)
Contact:

Post by ghiboz »

suliman wrote:do you want the node to be using the light you added? Shoulsnt you use

node->setMaterialFlag(video::EMF_LIGHTING, true); //enable light

Or did i misunderstand you maybe.
changes nothing,
but the lighting flag is not only for the material that you want to make a light, not a "light recever" ?
or not?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

EMF_LIGHTING has to be true in order to receive light. light scene nodes shouldn't have EMF_LIGHTING enabled.
ghiboz
Posts: 37
Joined: Tue Jan 15, 2008 12:09 pm
Location: Centallo (I)
Contact:

Post by ghiboz »

hybrid wrote:EMF_LIGHTING has to be true in order to receive light. light scene nodes shouldn't have EMF_LIGHTING enabled.
ok! tried and now works!!!

thanks for all! :wink:
Post Reply