ands / lightmapper

A C/C++ single-file library for drop-in lightmap baking. Just use your existing OpenGL renderer to bounce light!
1.41k stars 133 forks source link

How to pass lightmap data between passes #5

Closed braddabug closed 7 years ago

braddabug commented 7 years ago

What's the correct way to transfer the lighting results of Pass N to Pass N+1?

From looking at the sample, it seems like the results of each pass is converted to a plain old texture, and then the next pass uses that texture as emissive data. But that seems wrong. It seems like you wouldn't want to convert the HDR lightmap info to an actual texture until the very end of all your passes/bounces. You'd want to keep the original floating point 32-bits-per-channel array you pass to lmSetTargetLightmap() around for use in the subsequent pass, rather than rely on a clamped/exposed/processed 8-bits-per-channel texture.

So am I just doing it wrong?

ands commented 7 years ago

You can just use a floating point HDR texture format for rendering. That's what I do :)

braddabug commented 7 years ago

Oh, yep, that works.