Lighting Manager. Testing, Discussion etc.

Well, I’ve got a week of ‘holiday’ cough study break, and so dug out where I was on my last project, which happens to be my lighting manager.

At the time, I was held up by a couple of bugs which have now been fixed (thanks to whoever allowed spotlight shadows to change size). As it currently is, it fills the need for my project, mostly. So I’ve got a few questions, but I’d also like suggestions.

What it does:
This is designed as part of a ‘base’ scene. What I mean by this is that your game consists of a level, some characters/assets, in-game menu’s, a HUD etc. Then there is one scene that libloads all of that together into the game you play. So a couple of frames after game-start, the lighting manager will compile a list of all lights in the scene, replace them with empties, and then dish out it’s own supply of lights and shadow lamps to illuminate the scene with as little bother as possible.
Because the lighting manager uses it’s own lights, the original level scene could have hundreds of lights, but only the closest (ideally visible ones) will be displayed, resulting in much lower rasterizer time, and consequently, bigger possible levels.

It also implements my point-light-shadow-fudge-up, which is demonstrated in this video here:

It automagically assigns things like lamp type, (ie spot or point, it won’t touch sun lamps), energy, color, falloff etc. (not tested thoroughly yet, but in theory it should…)

Feature Requests for Blender:
Currently I can’t access/assign that many things about lights. Things I’d consider necessary to see python bindings for:

  • Specularity toggle
  • Diffuse toggle
  • Sphere toggle
  • Addition of light types such as ‘HEMI’ and ‘AREA’ to the light.type, as opposed to just dumping them under ‘NORMAL’

Ones I’d like to see:

  • Change from variance to simple shadow via python
  • Change variance shadow values dynamically (ie bleed)
  • Clipping levels of shadows (perhaps a whole shadows section)
  • Only shadow toggle
  • Square toggle for spots

I hear the developers groan as they read this. The one I really root for at the moment is the first. The ability to dynamically switch specularity on and off based on line-of-sight to the lamp casting it would be fantastic. In fact, it appears to be what happens in some other modern-ish engines.

So, to the community:
What do you want to see from a lighting manager? Unfortunately I won’t be building it directly into the engine itself, so it will remain a little bit of a pain to set up/use. But the current feature set of:

  • Point Light Shadows
  • Controllable maximum number active lamps/shadows

Seems a little small, compared to it’s limitations of:

  • Any custom logic bricks on lights get deleted
  • No animatable light values
  • Can’t toggle specific lights on/off mid-game

So what do you want to see added, if anything?

Here’s the bit that some people want to see, but maybe only two will understand, and probably only I will ever use. Here’s a zip file containing a ‘level’ and the base lighting manager:
Lighting Manager

Please test it, see if you can crash it, let me know what framerate you’re getting etc.
Some particular things I’d like you to test:

  • Does it work if you export it and run it? (Has issues for me, is it just me? I hope so)
  • Do the shadows even show?

And my linux graphics drivers just crashed… See you guys later

Hello! I got the shadows working in blender, but in external player or when exported I see only the lights, no shadows. Am I doing something wrong? Also for the animated lights if they are added couple of seconds later after the manager kicks in, wouldn’t they be working as regular lamps?

Well I found the problem with the external player not doing the shadows. I forgot to add a material to the pillars! Now I feel dumb for taking a week to find it!

Good point about the animated lamps.

Looks good when I turn on specular on the lamps, everything lit up much better. When the lights don’t have specular on everything is dark and the energy of the light seems to be lower.
Edit: And if you want people to test it you could at least put a good control cube in there, I can’t even back up with the one you put in.

Thank you for your input. Hopefully I can get a better demo going sometime soon.

I just tried to play Lighting Manager v1.blend and it froze my computer.

And here’s what I mean with the specular:

The top picture has all the lights with no specular(how your file came) and the bottom picture has all the lights with specular. There is no reason for the floor to be dark on the top picture. Basically everything becomes normal when I turn specular on, but it has to be every light that has it on for it to work.

It shouldn’t be that hard to get a better player control. Just use this:


MouseLook.blend (583 KB)

Hmm, there should be shadows in that file I provided, unless you tweaked the shadow lamp count to zero in the script!
Mine looks like this:

I’m currently building a better demo for it. Hopefully have it out in an hour or two.

Hmm, normal maps are having issues. Anyway, here’s a quick screenshot or two:

Looking down a dark hallway, your shadow in front of you. Fairly typical, except the shadow comes from a ‘point’ lamp. (well, a spot pretending pretty well to be a point)

Here you can see point lamps again, not lighting places through walls!

Also, there’s some pretty nifty shaders in here. The cave is box-mapped, as are the floaty-lights.

However, my GPU is stuttering under the load, hence the low framerate. I am on a laptop, so you desktop guys will probably do better, but I’d like to see if I can optimize it better. Should be possible.

Nope, no tweaking from me. It might be because I have a crappy computer, although the shadows did work for me in the version you had in the resources forum.

Where can we download the new version?

Ok, then I definitely need to optimize it. I think the current version has some heavy graphics-ram requirements. I think I can reduce that a lot. At the moment you can’t download the new version, it still has issues!