Implementing Environment Mapping and IBL for Deferred Shading

Our deferred rendering has reached the point where we need to apply environment maps and IBLs to raise the quality to a higher level (since you can see that the cubes are clearly missing): Missing cubemaps

After hours of researching on this topic, I still haven't found a solution that really makes me happy.

This is what I have found so far

  • An additional forward forward result is added to the LA-Buffer. This seems like a bad idea, we use deferred shading to avoid multiple passes and then render everything again for cubemapping and IBL. But at least we could use the existing GBuffer-Data (inc. Depth) to render objects, and the choice of which cubemap to use can be easily done on the CPU.
  • Display a full screen plane and do some crazy selection of the right cube in the shader (which is done on the CPU in the shader). It seems even worse than repeating everything, the glsl shader will be huge. Even if I implement tiled-lazy rendering (not done yet) it still seems like a bad idea.
  • Also, storing the cube map information directly in the first pass user buffer is not applicable in my renderer. I used all the components of my 3 buffers (3 for ES 3.0 compatibility) and already used color compression (YCoCg) and normals (Transform Spheremap).
  • Last but not least, a very simple and not very good solution: use a single cube file and apply it on a hole scene. This is not an option because it will have a huge impact on quality.

I want to know if there is another approach for creating an environment wrapper. If that's not the best approach to them. My personal favorite is this second, even if it requires replaying the entire scene (at least on devices that only support 4 rendertargets).

+3


source to share


1 answer


After testing various things, I found out that the best idea is to use the second solution, however the implementation is tough. The best approach is to use compute shaders, however they are not supported on most mobile devices these days.



Thus, you need to use one cube file on mobile devices, or get the data into the buffer in the first render step. If this is not possible, you need to tiled it with truncation culling for each tile (to reduce the number of operations per pixel).

+1


source







All Articles