is there any effective solution to find 6 plane of frustum?
effective solution to find 6 plane of frustum?
You can transform a plane by multiplying by a matrix like this.
In normalized coordinates the 6 planes in opengl are
For directx, the last two planes are
mutliply each of those six planes by that matrix
(view * projection goes from world to normalized space, we want to go from normalized space to world space)
The result of multiplying each plane will give a 4 dimensional vector. where x, y, z, w of the vector can be copied over directly to the
plane a, b, c, d respectively.
Notice that the 6 original planes have a lot of 1s and 0s. This means there is a lot of wasted work so when you simplify the multiply, just
end up with adding or subtracting two value from the matrix to get each plane. The simplified extraction can be found in this paper.
http://gamedevs.org/uploads/fast-extraction-viewing-frustum-planes-from-world-view-projection-matrix.pdf
|a|
inverse(transpose(M)) * |b|
|c|
|d|
Where ax + by + cz + d = 0 defines a planeIn normalized coordinates the 6 planes in opengl are
[1 0 0 1] [-1 0 0 1]
[0 1 0 1] [0 -1 0 1]
[0 0 1 1] [0 0 -1 1]
where [a b c d] defines a planeFor directx, the last two planes are
[0 0 0 1] [0 0 -1 1]
Since we want to transform a plane from normalized space to world space we simply take the transpose of the view projection matrix andmutliply each of those six planes by that matrix
transpose(view * projection) * p
You notice that we don't take the inverse of the matrix since it is already the inverse of the matrix we actually want to transform it by.(view * projection goes from world to normalized space, we want to go from normalized space to world space)
The result of multiplying each plane will give a 4 dimensional vector. where x, y, z, w of the vector can be copied over directly to the
plane a, b, c, d respectively.
Notice that the 6 original planes have a lot of 1s and 0s. This means there is a lot of wasted work so when you simplify the multiply, just
end up with adding or subtracting two value from the matrix to get each plane. The simplified extraction can be found in this paper.
http://gamedevs.org/uploads/fast-extraction-viewing-frustum-planes-from-world-view-projection-matrix.pdf
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement