Flashlight help!

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
FireCross88
Posts: 14
Joined: Wed Jul 04, 2007 4:57 am

Flashlight help!

Post by FireCross88 »

How do I create a circle/cone of light that shines outwards onto objects/walls in the direction I'm currently facing? It must be able to be switched on and off!

Thanks!
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

spotlights are not yet supported. i think there are shaders around the forums you could use, and also iirc irrSpintz has spotlights.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Yeah! When are spotlights gonna be supported? :P :P :P (though they WOULD be nice to have ^^
Praetor
Posts: 42
Joined: Wed Jun 20, 2007 2:31 am

Post by Praetor »

I was able to add directX spotlights into the engine pretty easily a while ago, but they only worked with the standard per vertex lighting so it didn't look that great unless the surface it was pointed at had a lot of vertices.

Here's a topic that uses a shader to create a nice looking spotlight effect with per pixel lighting: http://irrlicht.sourceforge.net/phpBB2/ ... pixel+spot
"Surely we don’t need to waste resources on pathfinding; they just need to walk along the shortest route from one place to another." - EA Producer
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Last time I went for spot light support I first recognized that the SLight structure has a design flaw and later on my gfx card burnt up (not realted to the spot lights, though :wink: ) But I'll dig out those changes, fix the design flaw first and then add the spot light.
Praetor
Posts: 42
Joined: Wed Jun 20, 2007 2:31 am

Post by Praetor »

Yeah I was able to add it by adding a few variables to SLight (Theta and Phi for the spotlight cone, as well as Falloff, and a seperate vector3df for direction of the spotlight since the spotlight needs both a positiona and a direction and I added ELT_SPOT to the light type enumerated list) after that I just modified the addDynamicLight() function in the d3d8 and d3d9 drivers to have D3DLIGHT_SPOT as an option. As far as I can tell this works pretty good (no per pixel lighting though).

I'm curious as to what that design flaw was, or was this only in an older version of irrlicht?
"Surely we don’t need to waste resources on pathfinding; they just need to walk along the shortest route from one place to another." - EA Producer
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, the problem is that SLight has a position and the LightSceneNode also has one. In most times the two are the same, but it's easily done that you overwrite some value by changing and updating the structures the wrong way. So I'm going to remove the position from SLight and will use that from the scene node only. However, there are some problems with passing the correct position down to the drivers and shaders.
Post Reply