# Questions tagged [matrix]

A 2D array of numbers, symbols or expressions, arranged in rows and columns. Each row must have the same number of columns. The numbers, symbols or expressions themselves are called elements or entries.

505 questions
226 views

### Prevent tile layout gaps

I'm making a map viewer where you can specify where tiles go in a map and then see it on the screen, translate it, and zoom in and out. Here's a picture showing the tiles used to make my example map ...
348 views

### SceneKit-Convert a rotation vector into rotation matrix

I'm very new and I'm studying this ARKit code from RPasecky/CubesInSpace on github where he/she convert the point of view 's rotation vector into a rotation matrix ...
73 views

### Matrix transformations vs manipulating vertex data directly

I was wondering whats more efficient to do if you want to transform a mesh. 1) Transforming a matrix and pass that to a shader or 2) Manipulate the meshs vertex data directly I was wondering because ...
1k views

### Convert Quaternion to Matrix4x4

I'm trying to set Gizmos.matrix which is a 4x4 by matrix such that the gizmos drawn match the rotation of the object. However, I'm not sure how to convert the ...
375 views

### Creating a rotation matrix from an up vector without using trigonometry

I'm looking for someone who really understands vector and matrix algebra. I have a coordinate in 3D space whose origin is the centre of the Earth, and I want the coordinates to be on a flat plane at ...
83 views

### Oscillate an object's scale

I am able to scale an object using a scaling function I wrote. Internally it builds matrices that are multiplied by each of the vertices to transform them. The parameters I give the scaling function ...
112 views

### Mathematics: matrix-to-quaternion conversion in left-hand coordinate system

I am implementing a typical skeletal animation system, and it requires the usage of quaternion to interpolate rotations between each poses. The asset I import only has a transform matrix for each ...
308 views

### Mythbuster: Mirror Operation with Quaternion

Mirror operation : all vertex positions must be reflected by a specific plane (here YZ).Synonyms: FlipHorizontal, SymmetryX, MirrorX, What implementations I already know that work: 1) Multiplying ...
642 views

### Applying “zoom to the exact point” transformations to screen positions

I´ve implemented zooming of orthographic camera (just scaling it with its speed value): ...
244 views

### How to compose a matrix to perform isometric (dimetric) projection of a world coordinate?

I have a 2D unit vector containing a world coordinate (the player's direction), and I want to convert that to screen coordinates (classic isometric tiles). I'm aware I can achieve this by rotating ...
53 views

### Are there any math limitations on the near plane in a perspective matrix?

I've noted that if in the perspective camera I put near plane to a low number like 0.000001 and far plane to 1000 my render has ...
261 views

### Convertion from 3D to 2D openGL

Few days ago , we learned about Homogeneous Matrices in OpenGL class. From what I have understood , using these matrices we can convert 3D objects to 2D. However , I am facing some difficulties ...
144 views

### Smart algorithm to find clusters in matrix of numbers

I´m developing in C, a solver for puzzles like this game Bubble Popper (https://play.google.com/store/apps/details?id=com.bytesequencing.bubble_popper_ads). Fast explanation: we have to find clusters ...
81 views

### How many matrices do i need to represent a rectangular figure and translate it?

I'm learning math at the moment and i can't really understand the purpose of the matrix. Yes, i've watched several tutorials out there and reading the book but still confused. Correct me if i'm wrong....
594 views

### Transform inertia tensor using quaternion

I have inertia tensor T in body coordinates and quaternion q for the body. I know I can transform T to world coordinate by converting quaternion to rotation matrix R and then use the relation (R * T * ...
231 views

### Left-handed version of the reversed depth projection with infinite far plane

Let's say that I have standard left-handed WorldToView and ViewToScreen row-major matrices in the same vein as the DirectX ...
35 views

### View Matrix FINDING U

T<----------------------Q While making a view matrix, I usually cross product a (0,1,0) with W TO GET U W = (T-Q)/||T-Q|| U = (W X (0,1,0)/||W X (0,1,0) v = w x u this works most of the time. ...
23 views

### Locking global Y rotation component of camera orientation

Question: For research purposes, I'm trying to lock the global camera yaw in VR -- though, the "how" is more of a 3D math question and has little to do with VR. The user is in control of the ...
351 views

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

As I start to get some deeper(or at least a little bit better) understanding on how camera transformations works, I am curious about one thing: How much matrices should I use ? I mean, until now I ...
2k views

### Visualize BoxCast

Im trying to find a way to visualize, and Edit the Physics2D.BoxCast from the Editor. I wrote the methods below to visualize the BoxCast, and edit in the editor: ...
642 views

### How do i put XMMATRIX inside XMFLOAT4X4

I'm currently trying to move my weapon with the camera. To do this i'm creating a vector (tempVect) where i load how much the camera has moved compared to the ...
855 views

### Unity Matrix4x4 to rotate a point around a pivot / axis

I need the Matrix4x4 to rotate around a given axis that does not go through (0,0,0). Is there some built in straightforward way to do this in the Unity libraries, or do I need to build and maintain my ...
1k views

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

I learn matrix transformations for game design and I struggle with some basic concepts. I see the actual multiplication taking place before rendering in this sequence: MODEL into WORLD: multiply each ...
409 views

### Convert a transformation matrix from world-space to camera-space using Eigen

I have a transformation matrix, in world space. I need to convert it to local(camera) space. I have done the reverse of this (Local - to - world) using: ...
808 views

### Why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix?

I'm working on a 2D game engine project, and I want to implement matrices for my transformations. I'm going to use the GLM library. Since my game is only 2D, I figured I only need a 3x3 matrix to ...
56 views

### Matrix operations to flip 3d models front to back, without changing position

Multiple 3D objects look to be in the correct screen position, and I can move around them and this continues to be true, but each one looks like it is flipped back to front (I can see the backside of ...
268 views

### convert gl_Position into screen coordinates

Pretty simple question I think. I need to convert model space coordinates into screen space coordinates for a special shader effect. I am of course able to just convert them into gl_Position ...
1k views

### multiply matrix4x4 with vec4

I'm developing a game and I'd like to make model * pos4 calc (that's usual in glsl vertex shader) in cpu instead of doing it in gpu. I'm using LWJGL and for the math impl I use JOML. Anyone know how ...
204 views

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

In most game engines (Unity, UE4) if we select a model and press F, the camera moves and focuses to the selected model. I want to implement that for my models. I have a perspective camera and world ...
62 views

### Issues with OpenGL rotation matricies and shaders

I am having an issue with my rotations in my opengl shaders. My program works fine before I add in my rotation matrices. Here is an example, at YouTube. After I add rotations to my shaders, there are ...
84 views

### What is the best way of storing transformations for an object and then applying them with OpenGL?

First some background info... I have been working on a platformer game, which I draw with OpenGL. The platforms are cubes and the player is a cube. The platforms and the player (both cubes) are ...
256 views

### What's the difference between setTransformMatrix and setProjectionMatrix in LibGDX?

There are two method of SpriteBatch in LibGDX: setTransformMatrxi and setProjectionMatrix. ...
57 views

### How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape?

SOURCE : http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Mitchell_LightShafts.pdf This process is part of creating light draft effect. And I am suggested to do the described process in ...
330 views

### Help Understanding Cameras/View Matrices in DirectX11 (C#)

So I'm designing a soft game engine in C# on top of the SharpDX API (a C# wrapper for DirectX). As I'm designing the camera, though, I'm running into some issues getting the 3D perspective correct. I'...
343 views

### OpenGL Vertex shader matrix multiplication causes triangle to disappear

So i have a very basic functioning application, rendering a basic triangle (using vertex and fragment shaders) When I try to multiply the in-vector in the vertex shader with a mat4 the triangle ...
80 views

### Rendering perspective independent polygons in perspective view

I am creating an editor where I have "grabhandles" that can be dragged to transform a primitive object. My problem is that I can't find the correct solution to show these grabhandles in a perspective ...
77 views

### Cube Translation Looks All Wrong

I'm making a very simple cube in OpenTK and it seemed to be going fine until I tried to move it around. Moving it along the X Axis seems to elongate the cube, not the result I hoped for. My Vertex ...
91 views

### openGL Vertex Projection does not work as expected

I try to render a simple grid using glBegin(GL_LINES). I have a class Camera, which provides values like this: ...
616 views

### How do I create a view matrix that does not contain the camera translation?

I'm looking at this tutorial https://capnramses.github.io/opengl/cubemaps.html about half way down the webpage, there is a description of a vertex shader ...
743 views

### Passing Matrix to shader

I am learning HLSL and having trouble understanding how to pass matrices into the shaders to be able to perform the necessary operations within the shader to have the position values sent to the ...
513 views

### Getting world coordinates from mouse position

I am drawing a 2D mesh imported from CAD. The mesh vertex coordinates are in feet from some arbitrary origin and Z is always 0. I am supplying the coordinates to my shader program and using projection ...
345 views

### How to rotate to look at target

I have found other questions like this, but none seem to quite cover the situation I have. I am using DirectX 11 I have an object that has: Position (vector) Rotation (quaternion) View angle (pitch,...
2k views

### How would you design a transformation matrix to project absolute coordinates to any orthographic projection desired?

I am attempting to make an RTS based on AoE II HD Edition. I want to have ease of control by designing a transformation matrix given any style of projection I want. This is a good example of what I ...
145 views

### Drawing & transforming matrices upwards

I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale. I get my expected results If I draw my objects from my root node in this ...
41 views

### Transform point while keeping other points offset

I have the following situation: I've got a box with its center of mass transform matrix that I'm obtaining from physics simulation, i.e. it keeps changing with time. I've also got two points (actually ...
125 views

### Finding the Distance between 2 Objects

I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix ...
155 views

### Understanding the ModelView Matrix

I want to analyze the each component of my 4*4 ModelView Matrix. I came to know that the starting 3*3 of ModelView Matrix ...
138 views

### Rotating an Object Around an Axis

I have a circular shape object, which I want to rotate like a fan along it's own axis. I can change the rotation in any direction i.e. dx, dy, dz using my transformation matrix. The following it's ...