Reverse Z buffer #1497
-
What I want to achieve is a possibility of rendering of a huge objects (lets say an Island) from a large distance. I have a character on that island and I want to move camera far away from it to observe all the island. In other words I want to get rid of clipping effect of the projection matrix. I've read that one possibility is to use reverse Z buffer. And here is a nice article about it. But I am a bit lost, what should I do to achieve that in WGPU context and terms? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
In terms of wgpu, all you need it to use a floating point depth buffer (Depth32Float). Then on the math end, you want your projection matrix to invert Z. A lot of graphics focused math libs can generate these (see for example, glam's |
Beta Was this translation helpful? Give feedback.
In terms of wgpu, all you need it to use a floating point depth buffer (Depth32Float). Then on the math end, you want your projection matrix to invert Z. A lot of graphics focused math libs can generate these (see for example, glam's
Mat4::perspective_infinite_reverse_lh
). What are you currently using to generate your projection matrix?