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.
604 questions
0
votes
0
answers
26
views
The perspective projection change the sign of z
I have an issue, I am drawing a cube in 3d. I am using z-buffer for hidden surfaces removal.
But the hidden faces are drawn (i see the inside of the cube). After some research And I found that this ...
0
votes
0
answers
75
views
Matrices for OpenGL shaders
So I'm trying to figure out the model, view and projection matrices.
I can, with some effort, find my drawings (3x3x3 structure of cubes) in 3D space and it looks like:
The problem is, the cubes seem ...
0
votes
2
answers
67
views
Custom matrix structure with OpenGL shaders
I have a MAT4 structure.
...
0
votes
0
answers
57
views
Matrix parent-child transformation for 2D positioning
I am working with matrix math for parent / child transformations. I have to modify existing calculations to keep child scale constant while also keeping child position relative to its parent.
Here's ...
0
votes
0
answers
29
views
OpenGL, How should I pass the matrix using VBO and binding points?
I'm trying to make a simple example in OpenGL and C++ to draw a square and change position and size through an array.
my problem lies precisely in the passage of the matrix to the shader.
I initially ...
0
votes
1
answer
106
views
Camera rotation in TouchDesigner
I need help on something I'm struggling with very much.
I am working on a TouchDesigner patch where I have a Camera COMP with rotation on x, y and z axes. I need the formulas to convert such rotations ...
0
votes
0
answers
36
views
Dimetric Screen to World coordinates
I've got a successful projection of world coordinates to the screen, but when I try to generate a ray for screen coordinates to the world, it always generates a fixed point which is invalid.
I started ...
0
votes
1
answer
113
views
How can I calculate vertex positions for a rectangle outline using a unit square, vertex normals, model matrix and outline thickness?
I'm trying to draw a hollow rectangle (i.e. the border of a rectangle without the middle) using a unit square plus normals. The actual positions are being calculated in my vertex shader.
For example, ...
0
votes
0
answers
340
views
invert:condition "det==0" is true error with no obvious cause
For my project I am turning my CharacterBody3D 90 degrees on the x-axis towards a wall.
To achieve this I set basis.Z to the <...
0
votes
0
answers
80
views
How to make calculating the inverse matrix more robust?
When I calculated the inverse matrix, I found that the error in using the float data type would cause the inverse matrix calculation error. Is there any good solution?
...
0
votes
0
answers
57
views
How to obtain the Position on the screen (Vector2) of the Position of an object in the world (Vector3)?
I have been searching around for a solution to this but still haven't been able to use it or find it, the thing is i need the Screen Position of an object that is being seen, for this i have three ...
0
votes
0
answers
37
views
2
votes
1
answer
438
views
How do I create a localtoworldmatrix and worldtolocalmatrix in Godot?
From what I can tell Godot uses Projection for 4x4 matrixes, but I see no way to generate a localtoworldmatrix from a given transform in Godot, how do I do this?
0
votes
0
answers
27
views
Relationship between matrix storage order and matrix notation?
This is how I (possibly mistakenly) understand it. Please correct me if I am wrong.
Assuming a 4x4 matrix composed of vectors v0 through v3 is stored in a one-dimensional array with indices [00] ...
0
votes
1
answer
45
views
Rotate UVs in shader and contains result into quad with repeat edge pixels
I ask for help - I need to rotate the UV scan inside the quad by a certain angle (set by a parameter) so that the result is embedded in the original UV, and the missing areas are repeat edge pixels. ...
2
votes
0
answers
109
views
How to correctly rotate 2D orthographic projection around a central point?
I want to rotate a 2D orthographic projection around the centre point of my view. However, something is off (it looks like a translation) but I'm not sure what.
To put some concrete values on the ...
0
votes
1
answer
166
views
Inertia Tensor Relative to Center of Mass vs Inertia Tensor in Body Coordinates
If I have the inertia tensor relative to the center of mass, is that the same as the inertia tensor in body coordinates?
If no, can you please explain the difference and how do I numerically calculate ...
0
votes
1
answer
100
views
Screen position in Deferred Shading
I am trying to implement a program in Direct3D 11 which uses techniques like deferred shading and shadowmapping, but when I create my gBuffers, the position looks strange. After researching a bit I ...
0
votes
1
answer
727
views
How to set up view and model matrices for 3D rendering?
For various reasons I am building a very simple graphics engine. I have a pretty good 2D thing using plain SDL2 and C that essentially boils down to a single "putpixel" function. I can ...
0
votes
1
answer
35
views
Error in directional light shadow projection matrix
I have VC++ code for DX9 that draws shadows perfectly.
...
0
votes
1
answer
78
views
Align two meshes given 2 faces
I have two meshes (A and B) and I know that a triangle in A has the same size and same angles as a triangle in B.
For simplicity, suppose A is an octahedron and B is a tetrahedron. And suppose the ...
1
vote
1
answer
614
views
Implementing a Maya-like orbit camera in Vulkan/OpenGL
I want to create an orbit camera with zooming, panning, and rotation. I used the following examples to create cameras:
https://stackoverflow.com/questions/54400422/how-to-implement-altmmb-camera-...
0
votes
1
answer
831
views
Calculating LookAt position from rotation and translation matrix
I was wondering if it was possible to calculate a lookat position from the translation and rotation matrices (aka the building blocks of my view matrix). I need the lookAt position to implement a ...
0
votes
2
answers
139
views
Find coordinates in one space from another
I'm trying to determine what coordinates are in one space when given a point in another space.
For example, I've got a Matrix4x4 that I can use to convert a point in unity's world space to a skewed ...
0
votes
1
answer
66
views
correct matrix to draw mesh as flat object
I need to draw a tilemap for a 2d game. For that I created vertices with their relative positions already hard baked. The coordinates start top-left with (0f, 0f) and z is always 0.
I rendered them to ...
0
votes
1
answer
50
views
Removing duplicates/ignoring them from a 2 dimensional Array
I have a bool[,] Array for keeping track of Nations that are either at war(true) or neutral(false).
The problem Im having is that when going over the matrix, to display al wars in UI elements, it will ...
0
votes
1
answer
48
views
Object stuck to screen no matter what eye position is used
I've run into an issue when trying to write a simple rendering program in D3D11. I'm 90% sure it's to do with some faulty matrix multiplication or generation, but I've tried debugging the values of ...
3
votes
2
answers
2k
views
How to convert a 4x4 matrix transformation to another coordinate system?
Is there a general method to convert a matrix transformation from one coordinate system to another, so that the resulting transformation looks the same on screen?
For example:
There are some ...
0
votes
0
answers
357
views
Setting glOrtho and glViewport so top-left of window has coordinates (0,0)
I haven't used OpenGL for a long time and have trouble setting up a 2D screen where the upper left window coordinates are (0,0) and the width and height of the ...
0
votes
2
answers
140
views
Transforming 3d point for depth testing
I have a ray and its direction is (o,d). Multiply it by the model matrix to rotate the model.
...
0
votes
0
answers
153
views
How does this 4 by 4 matrix (about 4 points are coplanar) come up with this equation?
I have just begun learning some 3d mathematics and OpenGL (trying to implement skeleton animation).
I am stuck here when reading a book(Advanced Methods in Computer Graphics). I understand the first ...
0
votes
1
answer
318
views
Efficient calculation of billboard sprite transformations
I'm currently adding a billboard mode to animated sprites and static sprites in my 3D engine.
The code below works fine, but I want to know if a more optimized solution exists. I've heard about ...
0
votes
1
answer
556
views
How to convert a list into coordinates in pygame
I'd like to have a map in my pygame game but don't want to waste time moving each individual object in it. To resolve this, I'd like to iterate over a list like this:
[1, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, ...
1
vote
0
answers
180
views
Calculating bone transformation matrix for vertex skinning
I have an issue with calculating transformation matrices for animation mesh deformation using glm in c++
I have a class Bone which does the basic calculation which does have a current local position (...
1
vote
0
answers
316
views
Understanding matrix transformations for skeletal animation
I am working with Collada and GLTF.
Say I have a humanoid with 3 bones with the following hierarchy: B0(root) → B1 → B2.
Terminology:
bind pose is the same thing ...
0
votes
1
answer
66
views
Apply a mocap to multiple different models? -> modify gltf directly?
I am currently struggling with an animation I made that I would like applied to multiple models, all different, but from the same vertices.
I already have a custom gltf importer ready but I need to ...
0
votes
1
answer
212
views
Why would some assets require a transposed TBN matrix?
I'm writing an OpenGL/DX11 Windows/Linux "engine" and I've encountered a confusing behavior in DX, specifically. For math, I'm using GLM, which means all of my HLSL ...
0
votes
1
answer
71
views
Matrix math: How to specify camera distance so that an object with a given size is completely visible?
This is my code that draws a top down view tile based map. But Iam do not know how high the camera needs to be placed in the sky so that the map is fully visible so that nothing is cut away and I do ...
0
votes
1
answer
2k
views
How to calculate camera view matrix from world transform, specifically the orientation?
In my engine, camera is just any other object in the scene. It has a transform -- position, rotation (quaternion), and scale (ignored for camera view matrix). I want to convert this to the camera's ...
0
votes
1
answer
213
views
Find out (general) orientation of cube faces with rotated and translated camera
I have the following problem. I have a camera that is initially looking at a cube. The cube is with center at (0, 0, 0). The camera that is initially on (0, 0, 60). The camera can rotate and translate ...
1
vote
1
answer
182
views
Speed up Reaction-Diffusion simulation calculations in Unity
I'm trying to use Unity Job system to speed up some calculation related to Reaction-Diffusion simulation. The calculations requires 2 matrixes, current and ...
0
votes
1
answer
38
views
How are transformation matrices usually represented?
I know the bare minimum to do matrix multiplication and have implemented them from scratch a few times for various purposes, but every time I do, I make sure to be very clear to myself about where are ...
0
votes
0
answers
782
views
How to decompose a GLSL mat4 to original RTS values within vertex shader?
I need to get the rotation differences between the model and the camera.
convert the values to radians/degrees and pass it to the fragment shader.
for that I need to decompose and the Model rotation ...
1
vote
0
answers
556
views
What is the correct way to combine transforms together?
I have a type called transform in my game engine:
...
1
vote
1
answer
321
views
How to define custom coordinate space?
I'm trying to build small UI framework. And I want it to have a coordinate space such that origin is placed in top left corner (x increases to right, y increases to down). I think for UI it should be ...
1
vote
1
answer
67
views
Get local position of a skinned vertex
I have a formula for skinning, where a vertex is attached to 2 joints with some proportions:
B = M1*A*K1 + M2*A*K1
Where:
K1 and K2 are the proportion ...
1
vote
1
answer
81
views
Meshes seem to get distorted when I use rotate or zoom transforms (XNA/Monogame)
Whenever I seem to create a rotation matrix or try to zoom, the meshes that I draw to the screen get stretched and distorted.
I've tried to make a simple rotation matrix like this:
...
1
vote
2
answers
789
views
How to solve for the angle of a axis/angle rotation that gets me closest to a specific orientation
I’m using a 3D affine transform (a 4x4 matrix of floats) to represent a combination of translations and rotations in 3D space doing a sort of 3D turtle graphics kind of thing.
From this state I know ...
0
votes
0
answers
53
views
Right Axis warps on 3D planet's equator
I am using JavaScript and WebGL for a game which rotates a spaceship around a 3D planet. Below is the code for rotating a sphere spaceship and sphere planet. I looked over your camera code and now it ...
0
votes
0
answers
71
views
Trying to understand proper naming of transformations and coordinate systems
So far in my code I only dealt with transform matrices that I fed to OpenGL (the 4x4 float matrices), and had a class that was used to do transformations on the CPU side and generate the OpenGL ...