Light nodes and 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
Fabio451
Posts: 17
Joined: Sun Nov 08, 2015 4:50 pm

Light nodes and BSP

Post by Fabio451 »

Hi guys.
I'd like to understand something about light nodes and BSP maps.
Searching the forum I found this thread:

http://irrlicht.sourceforge.net/forum/v ... php?t=9768

which tells that dynamic lights does not works for bsp and suggests a simple patch on Irrlicht code.
The thread is pretty old. Is that still valid or is there something new in the later versions to use light nodes and bsp?

I tried setting up this way (mapnode is the ISceneNode that contains the level):

Code: Select all

mapNode->setMaterialFlag(EMF_LIGHTNING, true);
mapNode->SetMaterialType(EMT_LIGHTMAP_LIGHTING); // Tried many options
and I see that only misc_model objects are affected by light nodes.
If I want, let's say, a switch that turns on and off the lights in a room, should I leave bsp and use some other format (.3ds for example)?
Can you point me in the right direction?
Thanks.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Light nodes and BSP

Post by hendu »

It works fine if you use your own shader. You generally don't want to use the fixed GL lights, they are limited in many ways.
Fabio451
Posts: 17
Joined: Sun Nov 08, 2015 4:50 pm

Re: Light nodes and BSP

Post by Fabio451 »

Thanks hendu.
It's not totally clear to me what means "using my own shader" for light sources.
Is there some thread or page explaining that?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Light nodes and BSP

Post by CuteAlien »

It means you have to write code for the graphic-card which defines the material (typcially glsl or hlsl code which is kinda like c-programming except it has a few specific types for matrices and vectors and that code runs in different render-stages then for example for each vector used or for each pixel rendered). There is one shader-tutorial in Irrlicht, but it won't tell you how to write such a complicated shader. And it's also not trivial. Unlike hendu I think people should try to stay with fixed GL lights unless they have no other choice as it's way less painfull. In many cases using a light-manager is the easier solution (there is also an example for that). Thought at some point you might no longer have a choice simple because you can do more things with shaders than with the fixed functions offered by GL.

Unfortunately I don't know what the specific problem mention in the thread you linked is about.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Fabio451
Posts: 17
Joined: Sun Nov 08, 2015 4:50 pm

Re: Light nodes and BSP

Post by Fabio451 »

Basically the problem is that lights I add in my program don't affect meshes loaded from the bsp file (only misc_models are affected).
I already studied the good shader-tutorial, but it's not clear to me how to use shaders for creating lights.
Anyway thank you both for the informations.
I will keep on searching and I'll let the community know about some progress.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Light nodes and BSP

Post by CuteAlien »

Is it a bsp-file which you can post? It could a material thing, but I can't tell without testing.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Fabio451
Posts: 17
Joined: Sun Nov 08, 2015 4:50 pm

Re: Light nodes and BSP

Post by Fabio451 »

Thanks, CuteAlien. I'll try to post the bsp when I can.
Do you mean material type in the program? I tried many values in SetMaterialType() method with no result.
Or some kind of settings in NetRadiant?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Light nodes and BSP

Post by CuteAlien »

I meant in the program.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply