4 hours ago, KarimIO said:
Are lightmaps still the best way to handle static diffuse irradiance, or is SH used for both diffuse and specular irradiance now?
You can have lightmaps where each texel is SH instead just a single color. Advantage would be directional information, so you can apply indirect light to normal mapped surface properly.
For specular you are typically out of memory to store high detailed enviroment at every lightmap texel, that's why a sparse set of high resolution enviroment probes is common for this. (A 3 band SH has less detail than a cubemap with 6 * 2*2 texels, a 2 band SH is similar to 6*1 texel cubemap - not enough for sharp reflections)
In contrast, sampling diffuse indirect lighting from a sparse set of enviroment probes would be much worse than using lightmaps. Lightmaps have high resolution in the surface so they can store accurate local details, like shadows and darkening in corners. High resolution directional information is not necessary.
But there are many games that use either sparse lobes or dense lightmap approach for everything, others use sparse 3D texture bricks instead 2D lightmaps, many do not use precomputed lighting at all.
4 hours ago, KarimIO said:
Finally, how is SH usually baked?
Typically you generate n rays evenly distributed to any direction, for each ray calculate the incoming light (e.g. by path tracing), and sum up. Finally you normalize SH and done.
So you could do something like contribute each texel of a cubemap to a SH as well, just calculate direction to each texel and a weight (texels at corners are more dense than at a face center, the weight should compensate this effect)
There are other options than SH, e.g. Spherical Gaussians (https://mynameismjp.wordpress.com/2016/10/09/new-blog-series-lightmap-baking-and-spherical-gaussians/), low res cube maps (Valves Ambient Cube) or sphere maps.