dynamic lights

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
Scripter
Posts: 6
Joined: Mon Dec 17, 2007 3:20 pm

dynamic lights

Post by Scripter »

Im using a quake3 map(made one from scratch, having some trouble with lightmaps) and im using dynamic lights on it. Which seem to work but no really correctly.

code we use for the lights

Code: Select all

mLevelNode->setMaterialFlag( video::EMF_LIGHTING, true );
	mLevelNode->setMaterialType( video::EMT_LIGHTMAP_LIGHTING );
	mLevelNode->setMaterialFlag( video::EMF_NORMALIZE_NORMALS, true);

scene::ILightSceneNode* light = mSmgr->addLightSceneNode( 0 );
		irr::video::SLight l;
		l.AmbientColor	= video::SColorf(1.0f, 0.0f, 0.0f);
		l.DiffuseColor	= video::SColorf(0.6f, 0.6f, 0.6f);
		l.SpecularColor = video::SColorf(0.0f, 0.0f, 0.0f);
		l.Radius		= mLights[0].power;

l.Type = video::ELT_POINT;

			l.Direction = core::vector3df(  0.0f,
											-1.0f,
											0.0f );
			l.InnerCone = (float)mLights[0].innercone;
			l.OuterCone = (float)mLights[0].outercone;

we use that code to generate dynamic lights from the maps info, right now we have 4 lights placed out on the map.
Here are some screenshots
http://stefans.damnserver.com/screen1.jpg
http://stefans.damnserver.com/screen2.jpg

Here you can see how the light fligh around in a cirlce effect the walls very strange.

Anyone has any idea how to fix or another way to implement dynamic lights with Irrlicht.
thx[/img]
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

It's probably down to the lighting being per-vertex and your map's ceiling is just two large triangles which gives poor lighting results.

If that's the problem then it can be solved by using per-pixel lighting (write a shader for it or check the projects forum, there are probably some there) or by using a higher subdivision for your surfaces (i.e. more than 2 triangles)
Image Image Image
Frosty Topaz
Posts: 107
Joined: Sat Nov 04, 2006 9:42 pm

Post by Frosty Topaz »

If you don't need the lights to be dynamic lightmapping will be tons more efficient. What kinds of problems are you having with it?
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

First of all, direction and position are read-only in Irrlicht 1.4. You have to use the light scene node's position and rotation to specify those values. Moreover, direction is useless for point lights, just as the cone values.
What could be the problem is the default attenuation of the light, try to change the values to something like (0,1.f/power, 0) (in the SLight struct).
In case you use directional lights (spot or really directional) you have to rotate the local light vector (0,0,1) by the absolute rotation to get the actual light direction of the node.
Post Reply