Problem with textureProj(......)

This function means access the texrture with projection .But,when i was learning Shadow maps, i found myself do not fully understand the way textureProj works
,especially the meaning of access the texrture with projection.

could someone explain this function in detail for me ?

It’s really quite simple.

The perspective projection is an operation that involves two steps: a matrix multiply and a division by one of the coordinates.

When you’re doing perspective projections to compute window-space coordinates, you do the matrix multiply, and OpenGL does the division for you. This is important for things like perspective-correct interpolation and so forth.

Texture projection is the same thing: you’re projecting position values. Except here, you’re projecting them into the space of the texture rather than window-space. But the same process happens. You transform the positions by a matrix, and then do a division.

The textureProj functions allow OpenGL to do the division for you. So if you’re accessing a 2D texture, you provide 3 coordinates: the X, Y and W values from your perspective projection matrix multiplication. OpenGL will divide the X and Y by W and use the resultant value to access the texture.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.