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
2answers
40 views

Is there a way to figure out in which quad I am in fragment shader?

In my openGL project I draw a lot of quads (composed from 2 triangles) - for sake of example let's say quad 0,1,2 and 3. I process them in single pass. I do transform them with projection view matrix ...
0
votes
1answer
30 views

2d zooming function using transformation matrix

I'm trying to create a sort of "graphing calculator coordinate system" where you can zoom into a point by scrolling with the mouse wheel. I'm using javafx's transformation matrices (Affines) ...
0
votes
1answer
28 views

Rotation matrix for a model where the forward axis is not +X

I'm trying to convert a normalized unit vector, representing an entity heading, into a rotation matrix for rendering. The problem is that I'm using an (apparently) unusual forward vector for my ...
0
votes
0answers
28 views

Obj file vertex coordinates to new coordinate space

I am trying to convert the vertex positions in my obj file to a new coordinate system. I understand I need to multiply each vertex with the transformation matrix, however I am trying to figure out the ...
0
votes
1answer
17 views

Calculating view matrix from rotation, elevation and location

I have the rotation(A), elevation(B) and location(C) of a camera in a left handed 3d space. +...
0
votes
1answer
86 views

Difference between World matrix and Model matrix?

My current understanding of the Model matrix is that it is per object and stores the transformation, rotation, and scale of the object in local object space. What I'm not sure about, is that whether ...
1
vote
1answer
66 views

What are the pros and cons to using Transform{position, scale, rotation} over Matrix (3x4)?

I'm using Transform in a certain case where I want extracting/changing/preserving the components {position, scale, rotation} to be straightforward - I guess that is a benefit. But when it comes to ...
0
votes
0answers
24 views

3D to 2D transformations with numpy

I am trying to create my own game in the python terminal, but I just can't find something I can use in python. I found something on https://www.gamedev.net/forums/topic/59091-projection-matrix-amp-3d-...
1
vote
1answer
63 views

Matrix math in cascade shadow mapping

I am implementing cascade shadow mapping algorithm and currently stuck with matrix transformations - my AABBs, when projected in light space are pointing in the direction opposite to the light: I was ...
2
votes
1answer
172 views

Drawing OpenGL camera frustum

I am trying to display camera frustum in my OpenGL application. I calculate the vertices of the frustum pyramid using reverse projection from screen space to world space. The camera uses perspective ...
0
votes
1answer
48 views

How do I make 2D Camera Matrix with zoom?

I trying to understand how to make a 2D Camera Matrix. The problem now is when I zoom the world shifts horizontally. The Camera need to zoom on the current Position. ...
0
votes
1answer
33 views

Scene graph with camera

I need help with a little problem in my project, in which I have a scene graph with the intented camera like this: MovementNode Camera Node Mesh Object My problem is that I have the propagation of ...
0
votes
1answer
45 views

How to rotate multi-tile structure on grid?

I need to be able to place structures in my game that span multiple tiles and can also be rotated. My idea on how to solve this would be to use 2D arrays that hold data about the structure. EXAMPLE: (...
1
vote
1answer
68 views

Need help getting an objects orientation / all my OpenGL rotations are reversed

I'm using OpenGL on Ubuntu Linux with the Eclipse IDE and the GCC compiler. I am bringing blender models into a homemade renderer/game engine. I parse a text file containing object descriptions to ...
0
votes
1answer
57 views

convert world to screen coordinates with camera position and camera angle

Heyho :) I'm trying to convert world coordinates to screen coordinates. I have available: fov, screen width, screen height, camera position, camera angle and obviously the position of the object in ...
0
votes
3answers
152 views

Calculate angular velocity from rotation matrix difference

I am working on something for a game. I need to calculate the angular velocity, however in my situation I only have access to the previous rotation matrix and the current rotation matrix (and some ...
0
votes
1answer
113 views

Invert parent transform (doesn't work for combination of rotation and scale)

My problem I'm working with Qt3D and my problem is almost exactly like this one: https://stackoverflow.com/q/60995155/3405291 Suggested solution A solution is suggested here: https://stackoverflow.com/...
1
vote
1answer
363 views

How does glm::lookAt produce a View Matrix?

Say we do this: glm::mat4 View = glm::lookAt(glm::vec3(4,3,-3), glm::vec3(0,0,0),glm::vec3(0,1,0)); And after printing to the console with glm tostring (column ...
0
votes
1answer
35 views

Convert Global Space 3D Location to Local object space?

I'm trying to find a formula that could convert my 3D global coordinates into local object space. Here are the inputs I have ...
0
votes
1answer
67 views

Cylindrical billboarding around an arbitrary axis in geometry shader

I found an answer on this site relating to this question already, but it doesn't seem applicable in the context of my project. Basically I'd like to create a method which fits this signature: ...
1
vote
1answer
985 views

How to decompose a 4x4 TRS transformation matrix with negative scale?

As the title says I need to decompose 4x4 TRS transformation matrices and extract the proper scale vectors and the proper rotation vectors (or rotation quaternions). I know how to extract those ...
0
votes
0answers
79 views

Shifting the world origin and scaling all points?

Imagine you have a simulation in very large coordinates, and to render it out you need to scale it down (say, solar system -> fitting inside a few thousand units). This is controlled by a float ...
1
vote
0answers
39 views

Matrix transforming with translation/rotation/scale at center of screen

I'm trying to create a camera using matrix transforms, the gist is as follows: ...
0
votes
0answers
24 views

Rotate & Translate a MatrixTRS

Hello I have a question about translation & rotation of a MatrixTRS... So basicly I have a given MatrixTRS A in space, define by a positionA, rotationA and scaleA. (DISCLAIMER: I am using Unity, ...
0
votes
1answer
161 views

Random 100x100 map using all levels from 1 to 100

I'm developing a game where players walk though a 100x100 grid of different rooms. Each room has a level associated with it starting from lvl 1 to lvl 100. The map is divided into 10x10 areas and in ...
1
vote
1answer
51 views

Rotation matrix to look at point p

Assume a left-handed coordinate system where x is right, y is up, and z is into the screen. You have a unit vector pointing up along the y-axis. What's the rotation matrix for pointing the unit vector ...
0
votes
0answers
30 views

What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix?

So, I have an object in my custom engine (C++), with a column-major transform in world space. I'm using a package that takes a look-at direction as an input. What's the most efficient way to get a ...
2
votes
1answer
154 views

Rotate Object in world space - Raytracing

I’m programming a C raytracing project. I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it. For each object I have its position (x, y, z) in the ...
1
vote
0answers
21 views

Recognize L-Shape in a 4x4 Matrix

I'm trying to make a board game, there the player has to press four buttons to make the L. It can be mirrored or rotated, it just has to be an L. But if the player press four buttons and make another ...
0
votes
1answer
47 views

Match-3 should pieces store their location in the matrix?

I'm making a match-3 game. I have a TileManager script which stores all the tiles in a matrix, it's a singleton and it handles tile swapping and basicly everything regarding the management of tiles. I ...
0
votes
0answers
161 views

Intersection of ray and non-axis-aligned box

I need to compute the intersection of a ray with a non-axis aligned box. Currently, I transform the ray into the local space of the box, do classic ray-AABB intersection and transform the intersection ...
0
votes
1answer
115 views

What is the signifigance of the Dot Product in World to Local Transformations?

Looking for help understanding why this World to Local Space function works. I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert ...
0
votes
1answer
774 views

Should 3D transformations be represented by a 4x4 matrix or a 3x4 matrix?

Since 3D transformations are represented by 4x4 homogeneous matrices we know that their last row is always (0,0,0,1), and as such the behavior of this final row is implied so long as we know whether ...
0
votes
0answers
29 views

Projecting Coordinates from one Space into another, but with "twisting"

i'm trying to generate a decal mesh kinda like this: http://blog.wolfire.com/2009/06/how-to-project-decals/ but instead of projecting the decal with a box, i need to project it with a sort of ...
1
vote
0answers
53 views

Can't get world position from reverse Z buffer

I'm using this solution to render using a reversed Z buffer. This looks fine and completely fixes all my z-fighting, but it breaks what I use in shader to derive the world position from the depth for ...
1
vote
0answers
48 views

Why does the Modelview Matrix in OpenGL not have accurately signed vector values for look vectors?

When I do a GluLookAt(0.0, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0) so that I'm 500 units up on the positive Y axis looking down at the origin with the top vector of the camera pointing toward the ...
2
votes
1answer
59 views

Scaling a rotated child with parent-child transforms

In unity, if you parent something to another object, then give the child some rotation, and scale the parent, the scale applies to some arbitrary axis to the child, here's some pictures to demonstrate:...
2
votes
0answers
39 views

How to apply a color transform to textures when using pre-multiplied alpha?

I'm trying to apply a color map to my textures. The map is a 4x4 matrix that adjusts the contribution of each RGBA channel returned from the fragment shader. My texture needs to use pre-multiplied ...
1
vote
0answers
34 views

My triangle disappears when multiplaying by my perspective projection matrix

Whenever I multiply my transformation matrix, which is passed to the shader via constant buffer, my triangle disappears. Here is the code for the passed matrix: ...
0
votes
1answer
179 views

matrices and nesting hierarchy with game objects

Let's say we have some game objects and they are nested to form a tree: - A - B - C - D If each of those have a matrix for the scale, rotation and ...
0
votes
1answer
42 views

Broken model matrix builder

I'm trying to setup basic render pipeline in Vulkan and am currently setting up the perspective, view and model matrices. The line that calculates the position in the vertex shader is this: ...
3
votes
0answers
198 views

How to convert screen to world coordinates while using gluLookAt / gluPerspective or similar matrix transforms?

I am just starting an adventure in looking under the hood of graphics for a game project I've been working on for a while, and I could use some guidance. I am using Python/Kivy (though that is not ...
1
vote
1answer
801 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 ...
0
votes
0answers
38 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 (...
0
votes
1answer
655 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. ...
0
votes
1answer
40 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 ...
3
votes
3answers
1k 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
194 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
0answers
128 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
210 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 ...

1
2 3 4 5
12