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
1
vote
2answers
52 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 ...
2
votes
1answer
61 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 ...
1
vote
1answer
60 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 ...
1
vote
1answer
50 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 ...
0
votes
1answer
43 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(...
0
votes
1answer
45 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
28 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....
0
votes
1answer
46 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, ...
1
vote
1answer
40 views

Translate operation is rotating?

...
0
votes
1answer
35 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
58 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 ...
0
votes
0answers
19 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
1answer
40 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
19 views

Transform Vector3 into Vector2 with PerspectiveFieldOfView Matrix

If I understand correctly, Matrix.CreatePerspectiveFieldOfView(…) creates a Matrix that projects a ...
0
votes
0answers
23 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
110 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
42 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
34 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
183 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 / ...
0
votes
0answers
45 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
74 views

Finding translation component of a 4x4 matrix inverse

I have 4x4 matrix (A) (maya softw): ...
0
votes
1answer
143 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 <...
0
votes
1answer
119 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
40 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
61 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 ...
0
votes
0answers
58 views

Drawing simple shapes in OpenGL ES 1.1

I'm having an issue getting OpenGL ES 1.1 to draw anything. All I get is a black screen every time. I have the following working OpenGL 2.1 code, which I'm trying to change over: ...
3
votes
2answers
106 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 ...
0
votes
1answer
41 views

Unity Graphics.DrawMesh lags behind rotation?

I have a setup in unity using Graphics.DrawMesh() to draw a mesh on my players camera location in the update loop, ...
0
votes
0answers
20 views

Drawing ortho outline of rotated elipsoid

I'm working on a collision system for a 2.5D game, and I'm stuck on the sphereoids. As long as scaling x=y=z, and it doesn't rotate, I can just use an r^2 check, but I'm trying to figure out a way to ...
0
votes
0answers
49 views

btRigidBody world transform and scale issue

When I create a collision shape for rigid body (in this case box) I use vertices positions and scale from the opengl matrix, the code looks this way: ...
1
vote
0answers
59 views

Convert bones by bone matrix

I have a 3d-models from old game. They have the following structure: ...
0
votes
1answer
106 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: ...
1
vote
0answers
34 views

Blender - Exporting and Replicating Bone Animation

I'm having trouble replicating Blender bone animation in my game. Bones that have a vertical rest position (Euler(PI / 2, 0, 0)) are animated correctly (e.g. head, neck, torso, legs, shins), however ...
1
vote
2answers
134 views

How to access coordinates of objects in bullet physics (libGDX)?

I need to access the x, y and z coordinates of a bullet physics object. I'm assuming this is done via the transform matrix, but I have no idea which values mean what. There doesn't seem to be any ...
0
votes
1answer
38 views

Determine view-matrix with camera placed in a scene graph

My scene is organized with a simple scene graph where the child multiplies its transformation with the one of the parent. For normal objects, likes meshes, this works as expected, but I also want to ...
1
vote
0answers
40 views

Does it make sense for a view matrix to have a scale?

When building a view matrix from an SRT matrix multiply, examples (here and here) only ever compose it with a R and T. Does it make sense to have the S component be anything other than the identity? ...
0
votes
1answer
22 views

Display object at different position

Id' like to create impression of shaking holographic image of NPC in Unity 2018, but moving it with transform will cause unnecesary transform-rigidbody syncing, and using Rigodbody.position isn't an ...
1
vote
1answer
892 views

How do Axis-Aligned Bounding Boxes update with rotations?

I have a bounding box class with a min (x,y,z) and max point (x,y,z). The object that is being rotated has a rotation matrix (3x3 matrix), but I don't know how to update the bounding box with ...
1
vote
3answers
266 views

Rotation of a matrix with unequal rows and columns

I have this simple matrix class which has a char** array for storing the data. The data array gets initialized like this: ...
0
votes
1answer
261 views

OpenGL vector rotation matrix to a given point

I have a sphere with a radius of .5 The sphere is centred at 0,0,0 I am now trying to place items around my sphere based on a given x,y,z on the surface of the sphere. My items have been draw/...
0
votes
1answer
95 views

Sun model matrix

I'm playing with sun implementation in my engine and I correctly built model matrix using below order of matrix operations: Translate to camera position. Calculate x and y axis of rotation matrix ...
1
vote
1answer
145 views

Why does a translation matrix need extra row?

Following recommendation of this answer I've recently read the series of articles of Wolfire about linear algebra. I'm somewhat familiar with matrices and I came to a conclusion that vector and a ...
0
votes
0answers
30 views

anything wrong with a spherical camera view matrix?

Is there anything inherently wrong, if you derive your view matrix from 2 spherical coordinates (say, phi and theta) on the unit sphere? The z-axis vector would be at, say (phi, theta), the y-axis at (...
1
vote
0answers
49 views

OpenAL listener position for isometric camera

I have an isometric camera for an RTS that looks like this: Basically, I don't know how to set the listener's position in OpenAL because I represent the camera's position with only two coordinates. ...
1
vote
0answers
177 views

ANSI C (C11) math libraries? [closed]

I know there are a multitude of C++ math libraries out there, but my current project is C-only (C11). So far I've made due with writing my own matrix/vector functions, but now I need to do the more ...
-1
votes
1answer
38 views

How do i rotate my view on its own center

PROBLEM I am trying to translate and rotate my view, the translation works fine but when rotating the rotation is happening on the center of the world(0,0,0) instead of the view position. EXAMPLE ...
1
vote
1answer
31 views

How can I have more values in array on X axis than Y axis in my tilemap?

Following my old question Array of map data renders the map the opposite way after I got the answer to it and fixed my problem, I got another problem that occurs. If my ...
1
vote
2answers
290 views

Is clipping done before or after projection?

Is clipping applied after projection or before? How can it be applied after projection when a vertex is behind the camera and projected therefore mirrored? At this time I clip the triangle before ...
0
votes
1answer
42 views

Optimizing expensive calculation for calculating touch of side of cube

I have this code: ...