Questions tagged [projection-matrix]

234 questions
2
votes
1 answer

How to set an ortographic camera to project like described?

I would like the projection to be like this: That is, (x,y,z) -> (x-y/sqrt(2),y/sqrt(2)-z) How to find the projection matrix?
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
2
votes
1 answer

Why are two elements of my inverse projection matrix always 0?

I'm writing a ray tracer for which I need to cast rays from the screen into the world. I'm using the inverse of the view-projection-viewport matrix to get back from screen pixel coordinates to world space coordinates. I noticed by accident that two…
Boann
  • 48,794
  • 16
  • 117
  • 146
2
votes
0 answers

how to perform perspective transform in CSS given perspectiveTransform matrix from openCV

I ran this openCV command to get a perspective transformation matrix: projective_matrix = cv2.getPerspectiveTransform(src_points, dst_points) The output (projective_matrix): [[ 0.35330902 -0.20574606 222. ] [ 0. 0.12791606 0. …
2
votes
0 answers

Unity wants a Y-flipped projection matrix when rendering under Direct3D

First of all, hello, I have several questions tied together to this title, because I can't summarize all into one good question. To put the settings, I am using Unity 2020.1.2f1 URP and I am trying to rebuild myself the Unity's projection matrix…
2
votes
0 answers

glm::perspective function's near plane and far plane and aspect ratio

two questions but the first one is, in the learnopengl.com website, for the glm::perspective function, it tells me to input 0.1f for the near plane, and 100.0f for the far plane. Why do I supply positive numbers. Isn't OpenGL using a right handed…
2
votes
2 answers

Sequentially multiply matrices from a list by a vector at time t-1 (recursively)

I am trying to multiply a list of matrices, in the order they appear within the list starting with matrix 1, by an initial vector and then recursively; so matrix 2 from the list multiplied by that resulting vector. I have tried various iteration of…
2
votes
0 answers

Setting up perspective projection on Opengl ES 2.0 makes objects disappear

I'm working on a project using opengl-es 2.0, and I'm having some trouble setting up perspective projection. If I don't set up the perspective projection and simply multiply the object-to-world matrix (I believe it's also called model matrix) by…
uorbe001
  • 41
  • 1
  • 4
2
votes
1 answer

Perspective projection turns cube into weird tv shaped cuboid

This is my perspective projection matrix code inline m4 Projection(float WidthOverHeight, float FOV) { float Near = 1.0f; float Far = 100.0f; float f = 1.0f/(float)tan(DegToRad(FOV / 2.0f)); float fn = 1.0f / (Near - Far); …
vk123
  • 43
  • 4
2
votes
1 answer

Perspective projection inverting x axis (glm::perspective)

When I use a perspective projection in OpenGL, my X axis gets inverted as seen in the image below. The code below might not be valid because I changed it a lot in order to make it less obscure. It might not work, so just keep that in mind. Here is…
Serket
  • 3,785
  • 3
  • 14
  • 45
2
votes
1 answer

how to use JOML to simulate OpenGL like Model, View Matrices on 3D projection to 2D plane?

After years of taking beginner courses in OpenGL and linear algebra courses, I recently finally understood the point of the Model, View and Projection Matrices. Basically the Model Matrix converts the vertex coordinates of an 3D model into vertex…
Paiku Han
  • 581
  • 2
  • 16
  • 38
2
votes
1 answer

Building a Perspective Projection Matrix

my first post here but hopefully I can explain my dilemma with building a perspective projection matrix similar to the one in OpenGL. Being new to the 3D graphics space, I'm having trouble understanding what to do after multiplying my matrix after…
2
votes
1 answer

How to retrieve the camera origin/position from the view projection matrix? (OpenGL)

Is there any way to retrieve the camera origin/position from the view projection matrix? (OpenGL) I'm trying to draw the camera's frustum and I have no problems calculating corners for the Far and the Near planes. But I can't figure out how to…
Gediminas
  • 1,830
  • 3
  • 27
  • 47
2
votes
1 answer

OpenGL How to calculate worldspace coordinates from frustum aligned vectors?

I am a graphics programming beginner working on my own engine and tried to implement frustum-aligned volume rendering. The idea was to render multiple planes as vertical slices across the view frustum and then use the world coordinates of those…
2
votes
1 answer

Where is the returning values of cv2.solvePnP actually holding the camera's position?

There's a cube and a camera in the real world. Each point coordinates are shown in the following figure. It is clear that the camera's coordinate is at [0,0,1]. We can calculate each position's displayed coordinates on screen. import numpy as…
2
votes
1 answer

Oblique perspective - projection matrizes in processing

I want to extend processing in order to be able to render 3D stuff with oblique projections (cabinet or cavalier). After looking around source of the camera(), perspective() and ortho() methods I was able to set up an orthographic perspective and…
hlg
  • 1,321
  • 13
  • 29