ofxGPULightmapper | New Addon

Hi All,
The past months I’ve been working on a GPU lightmapper for openFrameworks.
It is a tool that generates nice and smooth sun light and ambient shadows.


Wow nice work!
Looks really good. :clap::clap::clap:


This looks really neat! :slight_smile:
I’ll try it and come back with comments.
thanks for sharing

1 Like

Thanks :pray:

Yeah, would be great to have some feedback.
There are tons of things that can be improved as well.

1 Like

Hi action,

I’ve just tried your addon on Windows 10 with gtx1060 and it works really fine. The quality of the rendering is impressive, probaly the best I ever seen on OF. Congratulation!

May ofxGPULightmapper be used with moving lights or 3D shapes that whhose vertexes move at every frame?

On example, I create 3D shape based on the blob I get from the kinect and then I add real time lighting.

Thanks in advance,.


Thanks for your answer

Outstanding news!
I’ve tried to compile the examples and it seems something is not right here. Screenshot attached.
I’m using macOS 10.14.6

Hi @Paolo,
Thanks, I apreciate it.

Even if I implemented a fast approach to a ‘traditional’ light baker, the technique is still too heavy and slow for realtime.
If your scene is small enough and you crank the samples up, you may get 24, 30 fps depending on your computer.

Maybe low samples + small FBOs + blur shader?

Let me know if you explore that. :slight_smile:

Hi @dimitre,

Thanks for reporting,
It look like the debugging textures are not appearing on the top left of the window. But the depth passes look working well.

I created a solution for the baking shader to not depend on specific nvidia/amd flags but it requires compute shaders. It may be due the lack of support of OpenGL from Apple.

Check if you have openGL 3.2 headers and libraries installed.
Can someone else with macOS test the examples?


1 Like

Hi action,

I made some test on your example to understand the behavior of your addon when something change in real time, like the light position. In fact, it takes some frame to update the scene and this can be a limitation for all those interactive application the have made OpenFrameworks so widely used. Right now I use ofxPBR that is a bit less refined than your addon, but it works in real time.

I think that a very useful improvement could be achieved by adding some user parameters to balance the rendering process between quality and speed. Someone could need less precision but faster rendering, someone else could preferer less interatcion but more image quality.


Hi @Paolo,

Yeah that is what I reply to you at the last message.

Lightmapping is a heavy technique that is usually calculated offline. For example, games engines bake statistic shadows before compiling so the game does not have to deal with it realtime.

The addon have many parameters you can adjust depending on your scene and setup.
You can increase the number of samples (per frame), so it will reduce the time it takes to generate a nice shadow texture.
Also you can reduce the default fbo sizes and it will make the baking process faster, being able to increase the samples.


Lush! :raised_hands:

1 Like

Hi @action
I tested it on macos 10.14.6 and it is super heavy yet the results look great. Although I am getting something different (I guess),
example-cached did not show anything. Just the background and white rectangle on the right side.

BTW, Compute shaders are not supported in macos

1 Like

The basic example is set to only calculate 1 sample per frame, it should run 60 fps easily and take around 3 second to have a nice result.
The vbo example is set to 5 samples per frame and will take around 1 to 2 second to calculate some nice shadows.
The ‘cached’ example calculates the depth test and bakes the shadows of each object independent. It also runs smooth and takes around 1 second to calculate each on the models on the screen.

Can you describe how heavy it is? it does run smooth? (fps)

Wait, really? I did not know that.
But then how are actually the first 2 examples running?
Without compute, no one would actually work.

Also, it looks like the debugging textures are working, but the depth test textures are not being shown. But did work, if not, you would have no shadows at all and seems there.

Thanks for the feedback.

Hi, thanks fro the explanation.

it runs at 7fps. Everything app starts to feel sluggish when any of the examples are running. Although my system is not very powerful; A 2014 i7 macbook pro with an ndvidia GeForce GT750M.

Yes. you need gl4.3 at least to run compute shaders, while macos only supports up to 4.1.
I’ll try to dig down a bit and see what’s going on.

All the best

Wow, 7FPS is terrible.
I can run the examples on my old laptop (i7-6th) at 60fps on Linux.

I also had MacOS performance issues with the Wave Function Collapse addon I published last year. I will try the same optimizations and changes I did back then for this one.

I guess we can blame apple, once again. :stuck_out_tongue:

What were those performance optimizations you made?

An implicit static_cast when pushing data to std::vector

1 Like