holland01 / YAQ3R

view a (I)BSP map!
Other
6 stars 1 forks source link

Near/Far clip plane range needs to be dynamic #8

Open holland01 opened 8 years ago

holland01 commented 8 years ago

A high near/far interval of, say, [1, 1000] results in extremely poor depth precision for depth buffers which are less than 24-bits.

So far, a range of [500, 5000](5000 could potentially be reduced) is a reasonable difference. However, clipping of the near plane be noticed if the viewing angle is < 0 radians. This angle can be calculated relative to rotating the world about the view-space x-axis; in other words, if the user looks up, we have a positive angle. If the user looks down, it's negative; a level-orientation provides a viewing angle of 0.

So, if a function can be mapped according to this change in viewing angle such that the output result is a newly defined near/far range, this should provide a significant visual boost without the need to use higher precision depth buffers or more complicated depth comparisons.

holland01 commented 8 years ago

Note: 500 actually isn't perfect even at level angles. It looks like more than just a viewing angle will be necessary to map correct values; things likely incorporating distances to farthest and closest objects, etc.