# Tag Info

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

Because $x_{proj}$ doesn't vary from $0 \to width$, it varies from $-\tfrac{width}{2} \to \tfrac{width}{2}$. What's important is not the width, but the minimum and maximum values of $x_{proj}$. ...
Accepted

### How to translate object to origin?

No, he's talking about subtracting the position of the cube from the vertex positions, so that your cube is positioned at the origin. If you positioned the cube at (10, 30, 15), you subtract that ...
Accepted

### Confusion about notation in a paper

The notation $\delta_{i,j}$ is the Kronecker delta, a notation commonly used in physics. It's defined as: $$\delta_{i,j} \equiv \begin{cases}1,&i=j\\0,&i\neq j\end{cases}$$ So, as you ...
Accepted

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

There is no 100% consensus on what order matrix multiplication should model things, worse the industry is split along this. Some sources use row major and some sources use column major matrices. Great ...
Accepted

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

When you scale along the X-axis, the X-coordinate (parallel to the axis) gets stretched, while the Y-coordinate (perpendicular to the axis) remains the same. You can think of scaling along an ...
Accepted

### Graphics Pipeline: Viewspace & Back face culling incorrectly

I (believe) I've solved this (even if it has taken 2 days). My problem was essentially I wanted to take the dot product of the face normal, and line-of-sight vector like below And determine the angle ...
Accepted

### Animating a smooth linear transformation

As a general rule, you cannot interpolate transformation matrices. In stead, you decompose them into their individual values, then interpolate those and recompose. The Möbius transformation as ...
Accepted

### Render with camera perspective off-center

Yes, you can use an off-axis projection matrix. This is what I use in my code (note: I shift the centre upwards, not left as you do in your example.) ...

### How is that possible that matrices can be thought as coordinate systems?

If you have a 3x3 matrix representing some transformation, you will actually have the X,Y,Z vectors of that transformation in the rows or columns (depending on if it's a row major or column major ...

### Solving a problem from *Foundations of Computer Graphics*:

Let me try to make my comment into a complete answer. The general idea is to build a linear system using those 6 point pairs and solve for the desired 12 unknowns. You may find this paper useful ...
Accepted

### 3D rotation matrix around vector

There is a direct formula for the rotation matrix for an arbitrary axis and angle. Given a unit vector $a = (a_x, a_y, a_z)$ and angle $\theta$, the matrix can be constructed as follows (derivation ...

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

OpenGL uses column-major matrices. For example, the translation values will be in the last row rather than the last column of the matrix. For example when loading matrices into uniforms in glsl, the <...
Accepted

### Affine Transformation

It is not necessarily affine. An affine matrix in homogeneous coordinates has a form like: \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ 0 & 0 & 1 \...
Accepted

### Image based lighting, tangent space coordinates, and optimization

Yes, you do need to transform the fetch direction into the space of the cubemap. If you could somehow figure out the fetch direction in the vertex shader, then you could do the transformation there ...

### Correct view-space transform

I've done some small changes to how I usually construct my view matrix, here is what I've modified: ...

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

You have to step outside the world of mathematics for a while and look at what we are trying to achieve. Mathematics in its purest form only tells us what kinds of properties certain constructs have, ...
Accepted

### Do we use 3x3 matrices in computer graphics?

That quote is a very strange way to phrase things. We definitely use 3x3 matrices in computer graphics. They tend to be most useful for doing affine transformations of 2D objects. It allows you to ...
Accepted

### Screen space coordinates to Eye space conversion

Object Space → World Space → Eye Space → Clip Space → Normalized Device Space → Window Space You get from Object Space to World Space by multiplying by the "World Matrix" (This may actually be ...

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

In a linear transformation system, your origin is always a fixed point, since 0*anything = 0. So imagine you have a cinema screen, and the origin is at the centre of the screen. Using linear ...
Accepted

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

The second matrix translates the eye [...] You don't do that in a projection matrix. You do that with your view matrix: Model (/Object) Matrix transforms an object into World Space View Matrix ...
Accepted

### Inverse matrix order of operation

Yes. If you're compounding operations to make a matrix, then the inverse matrix will be the compound of the inverse operations, in the reverse order. So if $C = AB$ then $C^{-1} = B^{-1}A^{-1}$ Think ...

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

The bottom row allows you to create perspective foreshortening. That is, it makes lines that are getting further away appear to converge. When arranged this way, we call this a perspective projection ...

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

So, A lot of folks would tell you that a 4x4 matrix is used so you can get a translation component rolled into your linear transformation. Meaning that with a 3x3 matrix you can only compute rotations,...

### How is that possible that matrices can be thought as coordinate systems?

A matrix can be used to transform a coordinate system into a new one. More specifically, it can be used to transform the basis vectors of a coordinate system. That's how it defines a new coordinate ...
Accepted

### Detect a lossy matrix decomposition?

You can detect a matrix that can't be decomposed in TRS form by taking its 3×3 upper-left submatrix, interpreting its columns as vectors, and dotting them together in all combinations (1 with 2, 2 ...
Accepted

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

glUniformMatrix4fv(transformLocation, sizeof(transform), GL_FALSE, &transform.m); The second parameter to ...

### Ladder to DNA using Transformation Matrix

You can't perform this transformation by applying constant transformation matrix to the ladder model since it's not linear transformation like joojaa said in the comments. What you would have to do ...

### How to get polygon coordinates in screen space

Edit: This answer is only helpful in 3D If you want to do it geometrically... The inverse of the view-projection matrix, $K^{-1}$ is the matrix you want. Where $K = View * Projection$ If $\vec{v}$ ...