Coder Social home page Coder Social logo

Comments (3)

robbiesri avatar robbiesri commented on August 28, 2024 3

In case anyone sees this later, the values returned by GetProjectionRaw are actually the tangents of the half-angles from the center view axis to the respective clip planes.

I assume this is because then the API doesn't need to take in a value for the near plane distance, like most APIs that provide 'left right top bottom' values for projection matrix generation, with the assumption that those values lie on the near plane itself. If you look at the documentation for XMMatrixPerspectiveOffCenterLH, you can see that the 'lrtb' coordinates are defined as being on the near clipping plane.

As for why the OpenVR API decided to use the tangent of the half-angles, I think it's because it elegantly generates other useful values easily. Do you need the FOV? You can use arctan to get the radians of the half angle. Do you actually want the 'lrtb' coordinates in view space? Simply multiply them by your near plane distance. For example:
*pfRight = tan(rightHalfAngle) = rightDistance/nearDistance =>
rightDistance = nearDistance x *pfRight

The only quarrel I have with the API is that it doesn't really make note that they are tangent values. I updated the wiki, hopefully that helps!

from openvr.

TheWhiteAmbit avatar TheWhiteAmbit commented on August 28, 2024

Why not use the conventional provided projection via
GetProjectionMatrix
instead as stated in the documentation:

"Most games should use GetProjectionMatrix instead of this method, but sometimes a game needs to do something fancy with its projection and can use these values to compute its own matrix."

https://github.com/ValveSoftware/openvr/wiki/IVRSystem::GetProjectionRaw

from openvr.

AnonymousVR-VR avatar AnonymousVR-VR commented on August 28, 2024

Hello, can you help me here: Modify GetProjectionRaw from a console application

from openvr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.