# Tag Info

### How does a 4x4 matrix represent an object in space and matrix lore?

How is Matrix Multiplication a Transformation? A matrix is just a big grid of numbers with rules that define how we can multiply it with other grids or lists of numbers. In games, we usually want to ...

### Why do we use 4x4 matrices to transform things in 3D?

3x3 matrices cannot represent 3D translations, but 4x4 matrices can A simple argument why 3D translations are not possible with 3x3 matrices is that translation can take the origin vector: ...
Accepted

### Why do we need a fourth coordinate to divide by z?

Because if you only divide [x, y, z] by z you get [x/z, y/z, 1] and you lost the actual ...

### How and when do the model to world, world to view, et cetera multiplications happen?

Think about it logically: What is your goal when you render something? To display it on the screen! What are the constraints? The model must be visible to the camera (i.e. in the view frustum, not ...

### Why do we use 4x4 matrices to transform things in 3D?

To succinctly answer the "why" question, it's because a 4x4 matrix can describe rotation, translation, and scaling operations all at once. Being able to describe any of these in a consistent manner ...

### Is a dynamic enviroment map using pincushion curvilinear perspective projection possible?

In practice, even when a scene is built to minimise problems, a 360-degree-FOV camera tends to introduce so much distortion in some directions that its results are useless for most purposes. If you ...
Accepted

### Do matrix manipulations for 3D graphics ever produce singular matrices?

The simplest way this can happen is if you shrink an object until its local scale in one or more axes is 0 (flattening it to a plane, line, or point). You can avoid this by disallowing scales below a ...
Accepted

### lookAt with orthographic camera (gl-matrix)

When I use the identity view matrix, I can see my model, but when I use LookAt, it is not visible. How can I see my model using ...

### Confused About My Code Suggesting The Normal Matrix Is Equivalent To The ModelView Matrix

When a matrix is orthogonal, inverse and transpose are equivalent making an inverse transpose equal to the original matrix. So if your model view matrix is orthogonal, the normal matrix will be equal ...
Accepted

### Finding islands from array

This is a standard computer science problem called connected component search. You can solve it in time linear in the number of cells using iterated depth-first / breadth-first search or a flood fill ...
Accepted

### OpenGL light appears to move with camera and changes with object rotation

From what I read from the shaders the light is in world-space and the light calculation is done on the object in part in untransformed object-space. You need to compute your lighting with both light &...

### How do you make a camera look at a box and ensure all of it is visible?

Take every point (vertex), project them into screen space (basically multiply them with the projection * view * model matrix). After you got this, take every point ...

### Is a dynamic enviroment map using pincushion curvilinear perspective projection possible?

The short answer is: yes, it is possible, but since the projection you desire is nonlinear, you must do one of two things: Subdivide the geometry finely and implement the projection math in the ...

### How can I reverse the effect of a transformation matrix?

If your transformation matrix is a rotation matrix then you can simplify the problem by taking advantage of the fact that the inverse of a rotation matrix is the transpose of that matrix. If your ...
Accepted

### How much matrices should I use for OpenGL transformation?

Your object is transformed in multiple steps, and for each step, you usually use a matrix. You can rotate, scale and translate every model. This can be done with three separate matrices, but usually ...
Accepted

### How to mirror/reflect/flip a 4D transformation matrix

To get a transformation matrix equivalent to the one you have, but reflected across a major axis you can compose it (multiply it by) a reflection matrix. That is, if you have your input matrix M and ...

### How to rotate a set of points on z = 0 plane in 3-D, preserving pairwise distances?

If I understand correctly, you have three points A, B, C, and three points ...

### Offset a camera/render without changing perspective

Wow that was fast. It's crazy how sometimes just writing out the question helps you figure out how to approach a solution. Here is my matrixPerspective function: ...

### From 3d rotation, snap to nearest 90 directions

For anyone in the future looking for a solution to this using Unity/C#, here is an implementation I made based on Steve's answer: ...
Accepted

### what is the very last element of a 4x4 transformation matrix for?

The value is for Homogeneous Coordinates. Using homogeneous coordinates makes it possible to use things like quaternions and projection matrices. The last entire row is actually for dealing with ...
Accepted

### Inline-Building a World (SRT) Matrix

A homogenous transformation matrix (aka a "World matrix") is a 4x4 matrix that defines the translation and rotation of one coordinate system with respect to another. It looks like this: ...

### Fastest way to neutralize scale in the transform matrix?

Assuming your matrix multiplication follows the convention... M * v = (T * R * S) * v (where M is your composed matrix, ...