Hi,
I am trying to modify my projection matrix in order to perform near-plane clipping (http://www.terathon.com/code/oblique.html).
However, in one of my project I use the reversed depth buffer trick (similar to what Humus explains here : http://www.humus.name/index.php?page=Comments&ID=255&start=0).
Now, basically, without any modification, the trick doesn't work.
So, I have tried to modify to technique, mainly, I tried to modify the clip-space corner calculation, and replaced (I am using the D3D variant):
with
However, this doesn't properly work, the depth values seem to be inverted a second time (while the oblique frustum modification should produce this I think).
Has anybody already tried to mix these both techniques ? I can't really figure out what's wrong...
I am trying to modify my projection matrix in order to perform near-plane clipping (http://www.terathon.com/code/oblique.html).
However, in one of my project I use the reversed depth buffer trick (similar to what Humus explains here : http://www.humus.name/index.php?page=Comments&ID=255&start=0).
Now, basically, without any modification, the trick doesn't work.
So, I have tried to modify to technique, mainly, I tried to modify the clip-space corner calculation, and replaced (I am using the D3D variant):
Code:
v = (sgn(vPlaneEq.x), sgn(vPlaneEq.y), 1.0, 1.0);
Code:
v = (sgn(vPlaneEq.x), sgn(vPlaneEq.y), 0.0, 1.0);
However, this doesn't properly work, the depth values seem to be inverted a second time (while the oblique frustum modification should produce this I think).
Has anybody already tried to mix these both techniques ? I can't really figure out what's wrong...