问题
Ok, I'm trying to understand how the face of a cubemap is selected using the coordinates supplied to textureCube()
. From the spec, I gather the coord with the biggest magnitude defines the face.
For example these coords (-0.2, 0.7, 0.65)
would select the Y+ face of the cube map, but these (0.2, 0.3, -0.8)
would select the Z- face.
Am I right in my understanding?
回答1:
Indeed you are. This is the simplemost way to select the face of a cube, given a direction from the center.
来源:https://stackoverflow.com/questions/6980530/selecting-the-face-of-a-cubemap-in-glsl