Cubemap face selection in GLSL

Ok, I'm trying to figure out how the face of the map cube is selected using the coordinates provided by textureCube() . From the specification, I collect the coordinates with the largest value that defines the face.

For example, these coordinates (-0.2, 0.7, 0.65) will select the Y + face on the cube map, but these (0.2, 0.3, -0.8) will select the Z-face.

Am I right in my understanding?

+6
source share
1 answer

You really are. This is the easiest way to select the face of the cube, given the direction from the center.

+5
source

Source: https://habr.com/ru/post/894531/


All Articles