Hi,
In this tutorial (https://learnopengl.com/PBR/IBL/Diffuse-irradiance) the author uses the following code snipet to sample from an Equirectangular map and draw it into a Cube (or convert it to a Cubemap later on):
const vec2 invAtan = vec2(0.1591, 0.3183);
vec2 SampleSphericalMap(vec3 v)
{
vec2 uv = vec2(atan(v.z, v.x), asin(v.y));
uv *= invAtan;
uv += 0.5;
return uv;
}
However, all the explanation it gives is that he's using some trigonomertic magic (spherical to cartesian), but doesn't give any reference beyond that, and haven't been able to find something useful in google that could explain the code above.
Anyone has a good reference that could explain what's going on here?
Thanks!