mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
045f324e97
# Objective Forward perspective projections have poor floating point precision distribution over the depth range. Reverse projections fair much better, and instead of having to have a far plane, with the reverse projection, using an infinite far plane is not a problem. The infinite reverse perspective projection has become the industry standard. The renderer rework is a great time to migrate to it. ## Solution All perspective projections, including point lights, have been moved to using `glam::Mat4::perspective_infinite_reverse_rh()` and so have no far plane. As various depth textures are shared between orthographic and perspective projections, a quirk of this PR is that the near and far planes of the orthographic projection are swapped when the Mat4 is computed. This has no impact on 2D/3D orthographic projection usage, and provides consistency in shaders, texture clear values, etc. throughout the codebase. ## Known issues For some reason, when looking along -Z, all geometry is black. The camera can be translated up/down / strafed left/right and geometry will still be black. Moving forward/backward or rotating the camera away from looking exactly along -Z causes everything to work as expected. I have tried to debug this issue but both in macOS and Windows I get crashes when doing pixel debugging. If anyone could reproduce this and debug it I would be very grateful. Otherwise I will have to try to debug it further without pixel debugging, though the projections and such all looked fine to me. |
||
---|---|---|
.. | ||
3d_scene.rs | ||
3d_scene_pipelined.rs | ||
cornell_box_pipelined.rs | ||
load_gltf.rs | ||
load_gltf_pipelined.rs | ||
msaa.rs | ||
orthographic.rs | ||
orthographic_pipelined.rs | ||
parenting.rs | ||
pbr.rs | ||
pbr_pipelined.rs | ||
render_to_texture.rs | ||
shadow_biases_pipelined.rs | ||
shadow_caster_receiver_pipelined.rs | ||
spawner.rs | ||
texture.rs | ||
texture_pipelined.rs | ||
update_gltf_scene.rs | ||
wireframe.rs | ||
z_sort_debug.rs |