fu5ha / ultraviolet

A wide linear algebra crate for games and graphics.
https://crates.io/crates/ultraviolet
741 stars 76 forks source link

Left handed Vulkan Y Down is (possibly) incorrect #162

Open hYdos opened 11 months ago

hYdos commented 11 months ago

Through a few days of debugging, I found that ultraviolet::projection::rh_ydown::perspective_vk appears to be wrong and had to write my own projection code to make my projection display correctly.

Here is the commit where i replaced the code and had it work for comparison

fu5ha commented 11 months ago

Are you sure you're interpreting rh_ydown correctly? Using rh_ydown::perspective_vk is meant to map from a source (i.e. your application's conventions) coordinate space of right-handed and y-down (+X points right, +Y points down, +Z points away from the viewer) into vulkan's clip space which is also right-handed and y-down. From a basic inspection, the commit you linked uses a matrix that would map from a source space which is at least y-up into vulkan's y-down.

fu5ha commented 11 months ago

I've revamped the docs of the projection module and its submodules in 13fc94f7c822d87620311f94d0e63853b53460e0, let me know if that makes it more clear. And if you still have troubles there indeed may be a bug...