Good day. I found this source: http://gamesmaker.ru/programming/directx/virtualnaya-kamera-perspektivnaya-proekciya/ information on how to set the perspective projection matrix for field of vision Y, the near and far boundaries of the review. This is all of course wonderful, but I just can’t figure out how to extract the width of the plane on which the objects are projected from these arguments? I work with WebGL and use a perspective projection matrix in the shader, but I just don’t understand how wide the plane is.

Personally, my problem is that when I clicked on the screen, I need to understand at what point (globally) the click was made. Of course, I can find the percentage from the center of the screen as a percentage, but I don’t know by what value to multiply further, because I don’t know the width of the projection plane. And is it necessary to take the depth of projection for this? I apologize in advance for a poorly worded question, I hope for your help, thank you.

    1 answer 1

    The projection operation is irreversible, because it makes two of three dimensions (the user does not specify the "depth" when you click the mouse?)

    To determine where the user clicked - you need to go through the active objects, project them on the screen - and see if this click falls into the area of ​​the object's silhouette.

    Sometimes, to solve this problem, a hidden surface is created on which active objects are drawn without lighting and tricky shaders, each object with its own color. Then, by the color of the pixel, you can determine which object the user clicked.