Baking deferred rendered textures

I have a deferred renderer setup and I am wondering if it’s possible to bake the resulting lighting pass into textures. I have the hunch that is not possible as I lose the 3d information as I am working in screen space. Thoughts?

You could copy the information back to textures, but the results wouldn’t be very good as you’d end up with highly-variable scaling. If you want to bake data into textures, you need to render in texture space so that the rendered fragments are aligned to the texel grid.

Thanks @GClements so I would have to have a full pipeline dedicated to rendering on texture space? Actually the problem is a bit more complicated as what I am trying to do is to bake screen space deferred decals into textures so you can imagine how needing to render everything twice once on screen space (so that the user can control the placement of the deferred decals) and once on texture space would be quite compute intensive. This is the project I am working on: GitHub - felipunky/ShirtGenerator

When you say

You could copy the information back to textures, but the results wouldn’t be very good as you’d end up with highly-variable scaling

how would that look like?

So that means having two different gBuffers as well? Damn I should’ve gone the forward renderer path!

Consider a square rotated around the Y axis so that it’s almost edge-on to the view. On screen, it will be much taller than it is wide. Each screen pixel will be a horizontal strip in texture space. So if you were to render the lighting in screen space then transform that back to texture space, you’ll end up with something which doesn’t look particularly good whenever the square is relatively face-on to the view.

If you’re baking lighting (or normals or whatever) into a texture, that’s usually something that’s done once (or occasionally) then the results are used each frame. If the lighting is constantly changing, there isn’t much point baking it.