Calculate amount of light as number

Would it be possible to dig into the source of the renderer and come out with a number that describes how much light is being cast on an object? I would want that number to be available per tick at run time.

I’ve poked briefly into some of the files in the Render folder of the source, but I don’t even know where to begin. Any direction at all would be most welcome!

You can definitely do it, since you’ve got the source code, but as far as I know you’d need to do a bit of the work yourself.

One way I’d look at is the shadow mapping. When the shadows are rendered from the light’s pov, you can add in code that does an occlusion query afterwards. You would run the occlusion query on the object you want lighting info on after the rest of the shadow map has been rendered and save out how many pixels would be rendered – this will give you some information on how many pixels of the shadow map your object takes up, and give you correct results when the object is hidden from the light by another object’s shadows.

I have no idea how much support there’d be for this in the engine; whether there are classes set up to do queries or whether you’d have to roll your own. But that could work AFAIK.

Thanks very much for the reply! I’ve decided to repost this question in the engine source forum as I think it might be more of a discussion than a question and answer. The post can be found here: