engine lights in BSP

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
MG

engine lights in BSP

Post by MG »

Is possible using engine lights in BSP scene (seeing lights on texture in bsp scene)?
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Well yeah, all you do is add a light scene node:

Code: Select all

scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(parent, 
core::vector3df(X,Y,Z), video::SColor(255, 255, 255, 255), radius);
where X,Y,Z are the corrdinates you want it at and radius is the radius of light, i.e. 1500.0f. Of course you won't be able to see the light itself, just the light that is shone on your world. So attach a billboard Scene Node that looks like a light to the Light Scene Node. BTW the lights aren't working correctly in OpenGL right now, only DirectX.
MG

Post by MG »

But when i add light to bsp scene, light not lighting :)
Where i doing wrong?

Code: Select all

scene::ISceneNode* node_light = smgr->addLightSceneNode(0,
	core::vector3df(0,60,0),
	video::SColorf(1.0f, 1.0f, 1.0f, 1.0f), 1500.0f);

node_light = smgr->addBillboardSceneNode(node_light, core::dimension2d<f32>(50, 50));
node_light->setMaterialFlag(video::EMF_LIGHTING, false);
node_light->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
node_light->setMaterialTexture(0,	driver->getTexture("particlewhite.bmp"));
Image
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

I'm assuming you're using DirectX b/c I think in OpenGL it would all be lit up. But it looks like you have some light on the ceiling, just not on the floor or sides? Your code looks correct, maybe try SColor(255,255,255,255) instead of SColorf(1.0,1.0,1.0,1.0) and see if there's any change. Also, try and change the coordinates of the light, move it around and see if there's any change...
MG

Post by MG »

In scene is only one light (with billboard), other 'lights' are in .bsp (textures). Can you see on this?
http://www.auto-myslivec.cz/img/irrlicht/lights.zip 500KB

Thank you
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

:? There has got to be something wrong with your map. I moved the light all over the place and nothing changed. So I turned up the ambient light all the way which should have lit up the whole room and still no change in light. I dont know what to tell you except try a different map, maybe someone else will read this and have an idea...
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

I did notice some things you are doing wrong. Your code for the light should look like this:

Code: Select all

scene::ILightSceneNode* node_light = device->getSceneManager()->addLightSceneNode(0,
		core::vector3df(0,80,0),
		video::SColor(255,255,255,255), 5500.0f);
	
	scene::IBillboardSceneNode* light = smgr->addBillboardSceneNode(node_light, core::dimension2d<f32>(50, 50));
	light->setMaterialFlag(video::EMF_LIGHTING, false);
	light->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
	light->setMaterialTexture(0, driver->getTexture("particlewhite.bmp"));
You were using the same ISceneNode for the light and the billboard. Make them separate nodes and the light should be an ILightSceneNode* and the billboard should be a IBillboardSceneNode* but strangely enough this still does not fix your problem... it must be a problem with the map.
Gonosz
Posts: 24
Joined: Wed Oct 29, 2003 4:21 pm
Location: Hungary (one joke and you're dead)

Post by Gonosz »

If you want to use dynamic lights in a lightmapped BSP, check out this topic: http://irrlicht.sourceforge.net/phpBB2/ ... c.php?t=85! In short: it isn't possible (yet) to use lightmaps and dynamic (created) lights as well...
Post Reply