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.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

How to fix roll in FPS camera when looking sideways [duplicate]

I am trying to calculate the rotation for an FPS camera. My closest attempt was to create a some Euler angles(from input) and multiply that with the view matrix, this works, but only if I am looking ...
0
votes
1answer
47 views

Inverse transformation matrix for checking whether a point is inside a rect

I'm trying to determine which nodes in my scene graph contain a given point in global coordinate space, using the inverse of the node's global transformation matrices. Here's a simplified version of ...
0
votes
0answers
31 views

THREE.JS - How to know the shortest rotation direction an object must do to look at other?

I am trying to understand a way in THREE.JS (and the mathematical foundation) to get the direction an object should rotate to lookAt other but without actually rotate it. I've tried to use ...
8
votes
3answers
1k views

Should I use a world matrix?

Image reference for the question: (image from the CG tutorial) The D3D9 API got us used to world matrices. However, if you use world matrices, then you have to do an extra matrix multiply in the ...
1
vote
1answer
259 views

Vertex Skinning, Bone matrices question

I'm creating a model/animation viewer in C# using OpenTK for a game's models. Before stating my problem I want to describe a bit what I've accomplished so far in case I'm fundamentally missing ...
1
vote
1answer
534 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: ...
0
votes
0answers
32 views

How do physics bones relate to animation bones?

Skinned animations use a tree of bones where the child bone (say a finger) is the weighted sum of the rotations of all it's parent bones. Physics bones are defined as a rotation matrix of a primitive (...
7
votes
2answers
3k views

Matrix rotation wrong orientation LibGDX

I'm having a problem with matrix rotation in libgdx. I rotate it using the method matrix.rotate(Vector3 axis, float angle) but the rotation happens in the model orientation and I need it happens in ...
0
votes
1answer
78 views

Camera rotation is weird when it's a child of another object

I implemented scene graph hierarchy into my 3D game engine, and there seems to be a problem with the camera's rotation when it is a child of another object. It only happens with the camera, not any ...
0
votes
1answer
52 views

Rotate coplanar 3D points to XY

I have a set of 3D points. All these points are on the same plane. I have the normal of the plane. Now I need to rotate them in such a way that the Z value of all these points become zero. (that is, ...
0
votes
1answer
190 views

How to set ortho projection / model view matrix without a camera?

I'm trying to create the correct projection and model view matrix for rendering without a camera. _orthoCamera is a camera I set up in the scene view. Using the <...
36
votes
6answers
23k views

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

To translate a vector by 10 unit in the X direction, why do we have to use a matrix? We can just add 10 to the mat[0][0], and we got the same result too.
0
votes
1answer
27 views

How can I skew a SpriteRenderer in an animation to grow a side and decrease the opposite side by the same amount?

I am interested in the maths and maybe the shader code. I am almost sure that this would be a great starting point but I do not have any knowledge about shaders and the language they are written in. ...
1
vote
3answers
126 views

Should calculations be done on the CPU or GPU?

I'm currently learning OpenGL and it's become obvious that I can do most calculations on the CPU or the GPU. For example, I can do something like lightColor * objectColor on the CPU, then send it to ...
0
votes
1answer
29 views

After rotated by Z-axis, X/Y axis still rotating just like z is 0

I'm making aerial vehicle controller, which can rotate 3 axis: X(Pitch), Y(Yaw), Z(Roll). Rotating x(pitch) and y(yaw) axis works fine, however after I rotated z(Roll) axis, x/y rotation gave me ...
1
vote
1answer
72 views

How to calculate rotations for an object with scaling transformations?

I am working on implementing scaling transformations into a game engine (C++), which previously assumed only translations and rotations. Visually, the scaling works, but a lot of the game logic ...
3
votes
2answers
107 views

most compact way to represent dice face translations rolling in cardinal directions

I'm making a 2-D dice rolling game in BASIC (think mechanics similar to Devil Dice on the Playstation, but top-down 2D graphics). I'm trying to accurately represent the transitions of a die when ...
3
votes
0answers
420 views

Control frustum near and far clip plane sizes in a Projection Matrix

I'm trying to achieve a dolly zoom effect. My first try was the obvious one, the original "zoom in & dolly out" technique, which works nicely. Except that there are cases which this is not ...
1
vote
1answer
57 views

What should the Z coordinate be after transformed by the projection matrix?

I'm working on an OpenGL 1.x implementation for the Sega Dreamcast. Because the Dreamcast didn't have any hardware T&L the entire vertex transformation pipeline has to be done in software. What ...
2
votes
1answer
70 views

What are the “axes of a matrix” exactly?

I am currently learning about game engines, and for the engine math, there are functions called GetXAxis, GetYAxis, and GetZAxis that returned the X, Y and Z axes for a matrix. These functions return ...
0
votes
1answer
49 views

GLSL: gl_ModelViewMatrixTranspose vs. gl_ModelViewMatrix

What is the difference between doing these two operations? Don't the first transform the vector from model space to view space? Then what does the second operation do? gl_ModelViewMatrix * vec4(...
1
vote
1answer
199 views

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

I have been following some tutorials on how Matrix maths works, with adding, dividing, scaling, etc, but I am struggling to understand how the 4x4 matrix represents an object's position in space. ...
0
votes
1answer
54 views

Which is a better way for moving 3d objects in OpenGL?

I'm learning OpenGL, and I'm a bit confused. I've just learned about projection and modelview matrices which can be used for moving things. This is the first way, which is convenient if I want to move ...
-1
votes
1answer
37 views

How to rotate a point around a pivot by changing the axis

I've been stuck on this forever now because I don't understand math in the slightest and when people talk about matrices they just give the table and don't explain how to actually go through each step....
1
vote
1answer
42 views
0
votes
1answer
45 views

Objects World Matrix Issue in Direct3D11

I have an issue with the transform matrix of my cube. When I change its position (world matrix) and rotate the camera, it is getting deformed. Here's my shader update code: ...
1
vote
1answer
64 views

rotation matrix problems - opengl and own types

In an effort to learn things deeper I'm writing my own mathematics for the first time instead of using libraries. As far as I can tell my matrix multiplication is correct, and translation and scaling ...
3
votes
1answer
384 views

What is FOVx in this diagram?

a beginner game developer here. I have recently taken upon learning about 3D game development and I am stuck on a simple matrix problem. The image is found from this article: http://www.codinglabs....
0
votes
0answers
24 views

How to program 3D translate widget like in blender?

Im struggling to achieve the translation widget in my own render engine. Funny enough I thought that widgets are easy, but boy was I wrong... What I want to implement: Where I am having problems: ...
0
votes
0answers
20 views

Transform Vector3 into Vector2 with PerspectiveFieldOfView Matrix

If I understand correctly, Matrix.CreatePerspectiveFieldOfView(…) creates a Matrix that projects a ...
0
votes
2answers
163 views

Finding the Distance between 2 Objects

I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix ...
7
votes
1answer
5k views

Bones Animation - Matrices and calculations

We are 'on final' when it comes to finishing the project, but just before implementing the animation system. Our Client decided to choose "Bones Animation" - which is that I should export each ...
1
vote
1answer
290 views

projection / view matrix: the object is bigger than it should and depth does not affect vertices [closed]

I'm currently trying to write a C 3D software rendering engine from scratch just for fun and to have an insight on what OpenGL does behind the scene and what 90's programmers had to do on DOS. I have ...
11
votes
3answers
18k views

How to get translation from view matrix

How can I retrieve the camera's world-space position from its view matrix? The only answers I've seen to this question suggest the translation is in the last row/col but this wouldn't work since the ...
0
votes
0answers
26 views

From look-at vectors to a quaternion

So, I have code to create a quaternion from a matrix (using the 3x3 rotational part.) And I have code to construct a transformation matrix from a lookat + up vector pair. To go from lookat+up to ...
1
vote
1answer
135 views

Finding islands from array

Say I have an two dimensional array with values 0 or 1. How would I construct an algorithm (preferably in C#) to work out which ones are separated or islands. The algorithm would transform the left 2d ...
1
vote
0answers
45 views

Matrix for transforming a square to a quadrilateral

I have a square of points {<0, 0, 0>, <6, 0, 0>, <6,0, 6>, <0,0,6>} (The square is placed at the origin in the xz plane in opengl). Want to apply a transformation/s on the square and make ...
0
votes
1answer
38 views

Z rotation matrix inverting object

I'm currently creating a 3d game where I need to rotate shapes. To do se, I created a rotation matrix for each axis, X, Y and Z. X and Y are giving me expected results, but not Z who kind of "inverts ...
0
votes
1answer
367 views

3d isometric projection matrix?

I have 3d vectors that I want to project as 2d vectors to draw my shapes. I got a 3d vector cameraPosition, a 3d vector cameraDirection, a float renderDistance. I need to create an orthogonal / ...
3
votes
1answer
402 views

How to prevent 2D camera rotation if it would violate the bounds of the camera?

I'm working on a Camera class and I have a rectangle field named Bounds that determines the bounds of the camera. I have it ...
0
votes
0answers
50 views

Orientation is off when nearing 90 degrees rotation

Context: I am using Vive Trackers to track the head of a user. It is not a Vive headset and I am restricted to the TrackingUniverseRawAndUncalibrated, which only guarantees that the Y axis will be UP. ...
0
votes
1answer
105 views

Finding translation component of a 4x4 matrix inverse

I have 4x4 matrix (A) (maya softw): ...
6
votes
2answers
38k views

How to get the rotation matrix to transform between two 3d cartesian coordinate systems?

I'd like to know how to get the rotation matrix for the transformation from one cartesian coordinate system (X, Y, Z) to another one ...
0
votes
1answer
112 views

Combine rotation XZ (horizontal) with YZ (vertical). Math formula

I'm trying to make a rotation vertically and horizontally around a point at the same time but I'm not able to combine both. I have this formula for the horizontal rotation: ...
5
votes
2answers
6k views

What does the identity matrix really do?

I understand that multiplying by the identity matrix is like multiplying by 1. Why would you multiply a matrix that will only contain the same result? Also, I'm experimenting with some OpenGL code ...
0
votes
3answers
332 views

Project rendering onto a polygon in the scene

I have a function that renders a simple OpenGL scene. I want to display this scene on a polygon within another scene, without the function having to know about it. For example, to display the scene on ...
0
votes
1answer
167 views

Normal Matrix in plain English

I'm into shader language with Webgl and GLSL. I've seen some tutorial about normal matrix and I don't really understand it. I mean, I think I'm ok with the math such as: ...
0
votes
1answer
41 views

Simplify Matrix math code- Sun billboarding

If was trying to set the correct position of my sun billboard in my 3d game. I tried long until it worked correctly, but I wonder why this code must be so complicated: ...
0
votes
1answer
102 views

What exactly does XMMatrixPerspective{L,R}H do?

There are generally three functions to create a perspective matrix in DirectXMath, XMMatrixPerspective{L,R}H, ...
0
votes
0answers
27 views

Swapping Axis by Swapping Matrix Rows

I'm using MathGeoLib, which uses row-major storage. The problem that I'm facing is that I'm going from a East-North-Up(ENU) coordinate system. And I need to go to an East-Up-North(EUN) coordinate ...