I'm currently working on a ray tracer in C++ as an assignment. This ray tracer needs to take into account environment maps, which I also need to implement a part of. From my understanding of an environment map, I need to follow this process: Given a 3d vector that represents the direction of the ray, I need to find a mapping from x,y,z to phi,theta coordinates, then use that mapping to get the color on the environment map. The (phi, theta) to (x, y, z) mapping is already given to me, but I need to invert it using acos and atan2 (C++ for arccos and arctan in range -pi to pi). I'm lost on what inverting the mapping means or how to do it. I'd really appreciate it if anyone could outline the process of inverting and describe the steps along the way. Thank you all!
gvec4 texture(gsamplerCube sampler, vec3 P, [float bias]);
. Take a look at this: registry.khronos.org/OpenGL-Refpages/gl4/html/texture.xhtml . Here is also a tutorial about environment mapping: learnopengl.com/Advanced-OpenGL/Cubemaps $\endgroup$