So konvertieren Sie den Kameraraum in den Weltraum mit Kameravektor und Rayvektor im Kameraraum
Posted: 05 Mar 2025, 07:46
Wie kann ich einen Kamera -Space -Vektor in den Weltraum des Kamera und den Vektor der Kamera -Speicherplatz umwandeln?
Beachten Sie auch>
Code: Select all
std::vector calculate_ray_heading(std::vector input_vector, double fov, std::vector uv) {
// Calculate the heading of the ray in world space given
// -camera vector (world space)
// -uv (converted to camera normalized device coordinates)
// -fov (ignored for now)
//convert uv2 to NDC (normalized device coordinates)
// changes range from [0,-1] to [-1,1]
std::vector ndc = {
(2*uv[1]) - 1,
(2*(1-uv[0])) - 1
};
//calculate ray heading in camera space
std::vector cam_space = normalize_vector(
{
1, ndc[0], ndc[1]
}
);
//convert cam space to world space
//...
//return world space
return world_space;
};