# Questions tagged [matrix]

The tag has no usage guidance.

69 questions
Filter by
Sorted by
Tagged with
25 views

### How to interpolate between two MVP setups?

I am currently writing an AR experience. I have a Camera View Matrix, A Camera Perspective matrix and the Model Matrix of the content I display. The AR content should can be switched to "2D",...
76 views

### Simulate projection matrix deformation in two camera setup

For educational purposes I'm trying to simulate what a scene would look like with a perspective matrix deformation (before everything is brought to NDC) but I'm unsure how to do this. I'd like to do ...
81 views

### Rotate a Bitmap with Shearing

I am rotating a bitmap using the three shear algorithm documented in these articles . From about 0-90°, the quality is acceptable, but beyond that it gets progressively more distorted until it's ...
29 views

### Bezier curve : Problem deriving control points from matrix form

This is my first post on this website so i have put in a lot of research to get my point across to everyone as clearly as possible. Based on a question i posted on stack overflow i have successfully ...
91 views

### Model View Projection Matrix Multiplcation Order

I'm working on a simple software renderer and have a working implementation so far. I'm curious as to why it's actually working since I would expect the multiplication ordering for my world, view and ...
55 views

### Matrix transforming with translation/rotation/scale at center of screen

I'm trying to create a camera using matrix transforms, the gist as follows: ...
350 views

### THREEjs: updating an object's matrix doesnt change it's position and rotation params

I want to set a transformation matrix to an object upon creation and then control it by position, rotation and scale, but while changing the matrix does change the object in world space, it's position ...
220 views

### How to calculate position from depth pass of the ZED camera?

I'm using the ZED 2 camera, and although the API provides a means of getting a point cloud position from a specific pixel, for my project I need to be able to perform this calculation myself from the ...
79 views

### Perspective projection near plane not in world coordinates

I have a camera I have placed zunits away from a billboarded rect. My goal is to discard all other geometry that is closer to the camera/in front of this rect. With ...
93 views

### Crystal ball rotation - I don't get why the code works

For context: I'm absolutely new to graphics programming and I've always had trouble getting the math. I had the task to write code for a crystal ball interface using OpenGL. There's an object in the ...
50 views

### Compose ViewMatrix and ProjectionMatrix

As the title says, you are able to compose the ViewMatrix and the ProjectionMatrix into one instead of multiplying a vector by the individual matrices. Instead of doing this at run time for each item: ...
227 views

### Which perspective projection matrix to use

I've seen two different perspective projection matrices being used but I want to know which one of them is the best. I think that they both output the same but I'm not sure. So if anyone can help me ...
432 views

### Why do we call it TRS and MVP, instead of SRT and MVP or TRS and PVM?

Here's something that's been bothering me while learning graphics. We have two core concatenated matrix sets: "TRS" for transforms, and "MVP" for moving everything into the canonical view volume. TRS ...
262 views

### Do I need a normal matrix if I calculate lighting in an objects space?

As a quick reminder, here is what normal matrix is and why do we need it. Now the question - if I take the light position and transform it into an object space than I don't need the normal matrix at ...
226 views

### Help with understanding the look-at function (the view matrix)

I've been reading this article about the look-at function. I don't understand the part when they're trying to inverse the matrix N. They say that R is orthogonal because all its row and column ...
208 views

### Camera position in vertex shader

in the vertex shader I have the vertex position vpos which is in object space and I want to get the vector going from the camera to ...
58 views

### How to find matrix that projects 3d points into 2d plane centered in the origin?

I have a list of 3D points defined by Cartesian coordinates, i.e. [(x1,y1,z1), (x2,y2,z2), ..., (xn,yn,zn)]. I want to project them to a 2D plane which has origin in the center (0,0,0) but which is ...
841 views

### Why does opengl use 4d matrices for everything?

What I managed to figure out is that the first 3*3 is used for rotation and scale and the 1*3 at the end is used for position, but what is the bottom row used for? is it only for clipping related ...
118 views

### My 2D translation matrix causes the box to be off screen when it shouldnt be

Now I know this isn't the way this is normally done so please bear with me. I am doing this this way so I know I have a solid conceptual understanding of everything that goes beyond example code. I ...
480 views

### Translate an arcball camera upwards or left-right

This problem is giving me a really hard time. I'm always looking at the origin and have a camera that moves around it in an arcball mode. That part works beautifully: I'm calculating the camera ...
506 views

### Rotation of a random unit vector at a point in 3D space by an angle

I have a scenario where I need rotate a vector ( unit vector) at a point in space by an angle along Z-axis. Is it possible to help me to understand a procedure to achieve this. I'm using vb.net ...
366 views

### How to apply scale, translate, rotate with different origin and get new rectangle coordinates

I was reading other questions in this topic but I couldn't apply any viable solution to solve my use case. I have a crop area described with two dimensions (cropWidth, cropHeight) I can easly compute ...
47 views

### Correctness or otherwise of the procedure for generating an orbiting camera in WebGl

I have to create a orbiting camera. I created the model of sun (a sphere) around (0,0,0) , triangulated and Phong shaded it. I would have a camera that goes around the sun thus an orbiting camera and ...
2k views

### How do I build my tangent space matrix?

I'd like to understand how the process of building the "tangent space" matrix for normal mapping works. I'm following several tutorials, and other stackexchange questions, but I'm unfamiliar with the ...
1k views

### Inverse value in a Perspective Matrix

I am a new leaner of computer graphics. I'm trying to understand a code I found online and I got stuck in the following formula: ...
280 views

### Inverse matrix order of operation

If I have a rotation, $A$, and a translation, $B$, which I multiply like so $C = AB$ Does the inverse of $C$ not only inverse the magnitudes of $A$ and $B$ but also become the reverse of operations? ...
12k views

### How to derive a perspective projection matrix from its components?

This has been haunting me for several days now. I want to find the component that makes up of this 4x4 perspective projection matrix, with $l$(left), $r$(right), $b$(bottom), $t$(top), $n$(near), $f$(...
88 views

### Modulo vs Scaling vs Capping when performing filters

I'm currently taking a graphics course and we've recently covered cross-correlation with regards to using a filter matrix that is applied to a region of pixels in a sort of continual raster-type scan ...
659 views

### why is translating in 3D space the same as shearing in 4D space?

I was reading "3D Math Primer for Computer Graphics and Game Development" and there was something the author had said that I thought was particularly interesting, he stated It is important to ...
4k views

### Screen space coordinates to Eye space conversion

I'm trying to figure out how to reverse Eye space -> projection -> clip(divide by w) -> screen space conversion. Basically, I want to get Screen space (still have z value for z-buffer) -> undivide? ...
73 views

### Why inverse of an allignment matrix is the same as its transpose?

$A_{v}^{-1}$ = $A_{v}^{T}$ $A_{v}$ = Allignment matrix that alligns vector v with z axis $=$\begin{bmatrix} \frac{\lambda}{|v|} & \frac{-ab}{\lambda|v|} & \frac{-ac}{\lambda|v|} &...
2k views

### How to decompose projection matrix?

I want to decompose projection matrices into near, far, top, bottom, left and right values to create a bounding box for view frustum. I used the formula described in this site Decompose the OpenGL ...
1k views

### What does it *mean* to scale in an arbitrary direction?

My graphics text explains rotating along the cardinal axes, then generalizes the math to show how to make a rotation matrix for rotating around an arbitrary vector. That all makes sense and I can both ...
72 views

### Finding all possible reflection matrices for a given Wythoff construction

As a pet project, I'm trying to build a small app that visualizes 4D polytopes. I want to use the Wythoff Construction method, where the shape is generated kaleidoscopically by the interaction of 4 ...
3k views

### Inverse-Transpose of Vertex Normals

For the past month, I have been learning on my own and writing a little graphics library and am currently working on the transformation of vertex normals to soon support lighting/shading. I understand ...
2k views

### Why do we multiply vertex from left side in vertex shader with matrices?

I have been learning OpenGL 3.3 and I saw this expression: gl_Position = projection * view * model * vertex I am confused because I read in some book that if the ...
3k views

### Why are width and height divided by 2 in the perspective projection matrix?

I'm using OpenGL to learn computer graphics. I'm trying to understand projection matrices. The following are shown in the OpenGL 'Red Book': I don't understand why the width and height are divided ...
2k views

### row and column majored rotation matrix pre- or post- multiplied

For column-major rotation matrices (right up forward in columns) do you right-multiply (post-multiply?) a row vector or left-multiply (pre-multiply) a column vector to result in a correct/valid ...
1k views

### Rotation matrix for a 3D object in space

This is the follow-up question from here: Minimum requirements to uniquely represent a 3D object in space Assume I have 3 original points in a 3D object (in 3D space) as ...
2k views

### Render with camera perspective off-center

So ordinarily we have this But I'm after this! Is it possible to do this? Ideally by changing the projection matrix? The reasoning is kinda interesting - I am developing for mobile VR, and I have ...
267 views

### Octave matrix to image pixels too small (do not have 1 pixel per integer)

I am working on a project which plots points over a checkerboard (representing seats for people). I would like each pixel in the image to represent each integer matrix entry. After updating my ...
363 views

### Final transformation matrix to transform world coordinate into vrc [duplicate]

For a 3D scene in the world coordinates, its View Reference Point $\mathrm{VRP}$ is at $(5,2,1)$, and a viewer is looking towards point $A=(1,1,1)$. Construct a transform matrix which will map world ...
366 views

### Tilting a 3d object to face a camera and have it look like it's spinning on the y axis

I have a scene kit app I'm working on and at a certain point I move the camera under a list of objects and tilt it up to give a star wars type view of them. I then need to pull the objects up one at a ...
1k views

### Building view transform matrices

For a 3D scene in the world coordinates, its View Reference Point $\mathrm{VRP}$ is at $(5,-2,1)$, and a viewer is looking towards point $A=(1,1,1)$. Construct a transform matrix which will map world ...
98 views

### Scalar multiplication in vecmath on Matrix4f results in strange values

So I have a matrix: ...
5k views

### Correcting my "look-at" matrix so that it works on non-camera objects?

I'm familiar with the "look-at" matrix and the goal of being able to rotate a Camera at a specific location towards a specified target. When I tell the ...
2k views

### Unable to pass custom Matrix4 to GLSL as a uniform

I am fairly new to graphics programming and I am trying to pass a custom Matrix4 (non-glm) to my vertex shader by using a uniform. ...
899 views

### What's a parent vector space or coordinate system?

After asking this question, a few new terms that I had never heard of came up. Note, I'm quite familiar with linear algebra, but I've never heard these terms in the context of linear algebra. ...