Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = near
- f = far
- _ZBufferParams =[(1-f/n),f/n,x/f,y/f]
- z = depth buffer Z-value (f+n)/(f-n)+2*f*n/(EZ*(f-n))
- EZ = eye Z value
- LZ = depth buffer Z-value remapped to a linear [0..1] range (near plane to far plane)
- LZ2 = depth buffer Z-value remapped to a linear [0..1] range (eye to far plane)
- GL:
- EZ = (2*n*f)/(f+n - z * (f-n))
- = (2*n*f)/(f+n - (f+n)+2*f*n/EZ)
- = (2*n*f)/(2*f*n/EZ)
- = 1/(1/EZ)
- = EZ
- LZ = (EZ-n)/(f - n)
- = n * (z + 1.0) / (f + n - z * (f - n))
- LZ2 = EZ/f
- = (2n) / (f + n - z * (f - n))
- LZ2 in two instructions:
- LZ2 = 1.0 / (_ZBufferParams.x * z + _ZBufferParams.y)
- = 1.0/ b
- b = (1-f/n)*((f+n)/(f-n)+2*f*n/(EZ*(f-n))) + f/n
- 好吧,我还是没推出来
Add Comment
Please, Sign In to add comment