Forget wanting to have deferred lighting in the BGE: Paper on Inferred lighting

It’s similar to deferred lighting in a way that you can have tons of lights at decent framerates, but Inferred lighting has big advantages which include full support for transparent and alpha faces and has more flexible support for materials.

Inferred lighting, if brought into the BGE will allow for better support of the current GLSL shading capabilities than Deferred lighting could ever do.

The .pdf is kind-of a big size, but it should show why future development of the BGE’s graphical capabilities should go the route described instead of just Deferred.

So, you are planning on implementing this into the BGE? If so, I’m all for that. Alpha mapped shadows was something I’ve always wanted put in. Sounds like it will be faster than deffered lighting too.


I’m no developer so I’m unable to do anything to add features to the BGE, I’m just putting this out there for interested users as well as those who know how to do OpenGL coding in the BGE source code.

And of course show others that there’s a better technique out there than deferred lighting in which various people here have touted as a must have feature for the BGE.

Wow, that looks really promising! I hope this make it into a 2.5 test build!

Impressive. I’d like to have that ability. I’d settle for 15 lights in a scene. At this point, I’m pushing it at 8 or so.

On a realated, topic, when do you think the GE will allow area, sun and hemi light shadows? I’d like my flickering torch lights to cast real-time, flickering shadows - not possible with a spot light, as a torch casts omni-directional light, like an area lamp.

You can make an omni-lamp cast realtime shadows by taking six spotlights, setting the shape to square, removing all blur from the edges, and making them all face at right angles to each other. See attached screenshot and .blend.
Unfortunately this is rather expensive - I get about 30-50 fps on the simple scene shown.

Edit - to move the lights in-game use the up and down arrow keys.


omni-test.blend (252 KB)

Very nice solution. My computer rocked that file at 1.8fps! Hell yea! I’m serious though - it’s a good idea, but for the moment, impracticable.

I’d settle for just Sun shadows (area would be next useful, and lastly hemisphere - a hemisphere shadow would just be like a sun shadow, wouldn’t it? Maybe not since a hemisphere lamp is 180 degrees). Inferred lighting sounds like a good idea - that along with Moguri’s patches would be nice new features for the BGE.

I have seen this paper plenty of times before. I have actually been planning to add inferred rendering as a GSoC project, along with possible other rendering improvements.

Even if I don’t get accepted into the Summer of Code, I still plan to add inferred rendering eventually, it just wont have as much priority then.

I am glad to see there are other people interested in seeing inferred rendering in the BGE though :slight_smile:

Wow. I look forward to seeing this!

So is there any chance to bring “defered shading” in BGE?

You’d have to speak to Kupo. I haven’t heard anything.

Okay, I hope there is a chance tho.
Deferred shading would be the greatest Blender Upgrade , and lots of people would start working with it.

Do note that the paper is not actually talking about deferred shading, it’s talking about inferred shading which is a tad slower, yet offers numerous advantages over the deferred method such as full support for rendering transparent objects.

Deferred shading , inferred shading it doesen’t even matter , we just need a new Render System.

Haha, i like the brutality.
In seriousness; is there any news, development or analysis as to the feasibility of this project?

Well, Kupoman posted a request for a new BGE branch called ‘GE Harmony’ today, I believe. It was a proposal to improve the lighting in the GE. I think that’s a great idea, and I think I’ll post on the list as well.

EDIT: I forgot to mention that Kupoman posted this on the development mailing list, and that’s where I saw the project.

Count me in :L!

Well the basics behind deferred rendering are really simple, you just need a normal buffer and position buffer. I made a deferred lighting in a GLSL 2D filter once. Extracted normals from depth, made a custom matrix from camera orientation and position, multiplied it with screen coordinates and thats how we get world position vector. This way we can have hundreds of lights rendered in screen space in shader itself. Deferred shadowing is impossible without FBO (framebuffer object) in BGE.
I am really waiting for real FBO, it will provide much faster 2D filters, a real normal-buffer, fast reflections and refraction, custom shadow types, like cascaded shadowmaps etc.

Yes! Lots of lights,better shadows, 2d filter speed up! That’s each BGE user dream.
Let’s hope we will have deferred/inferred shading one day.