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.

learn more… | top users | synonyms (1)

2
votes
1answer
229 views

How do I ADD gravitation to a rotation matrix?

I have ported the Matlab script from https://instruct1.cit.cornell.edu/courses/bionb441/LSystem/ to POV-Ray and everything works fine (although I'm not quite sure why). To navigate a "turtle" through ...
1
vote
1answer
65 views

Translation Matrix not working properly

Hello, I get this result when i try to scale and then translate a vec4 in my shader. I created a mat4x4 class on my own and some functions wich return some matrices for me, everything works, but not ...
3
votes
1answer
401 views

Finding out the “width” and “height” of my screen after projection added

In a 2d game, doing collisions with the edges of your screen is easy. Your textures are a 1:1 mapping of your screen resolution because your verities are too.. if your x position is > than ( screen ...
1
vote
1answer
23 views

Optimizing black and white matrix block drawing

Disclaimer: I am uncertain if this is the best place to post this question, so please advise me of how I can best find the answer if I am doing something wrong. I am asking this question because I am ...
1
vote
1answer
40 views

How to convert -1 to 1 coordinate back to screen coordinates?

Here is a question in which Questioner asks how to convert world coordinates to 1 to -1 coordinates like Opengl, I want to know how to do that in reverse, that given a coordinates between 1 and -1 (...
1
vote
1answer
26 views

Deferred rendering - reconstruction of world position view dependent

I am moving my small renderer from forward to deferred, I have now noticed something a bit odd. I am for now using a simple way to reconstruct world position in the lighting pass: float3 GetWP(...
3
votes
2answers
1k 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 ...
1
vote
1answer
219 views

Java OpenGL Perspective matrix not working

I'm trying to render a simple triangle with OpenGL in Java using LWJGL3. Everything is working great, but the projection matrix (perspective) is not working. In C++ I just used to apply the glm::...
0
votes
1answer
35 views

js canvas tiled map - for loop, while, or matrix

I am making a top-down view tiled map in canvas, where player is always in the middle of the screen, and map scrolls depending on where you go, like in moba games. I also want it to loop infinitely in ...
2
votes
1answer
730 views

importing animations in Blender, weird rotations/locations

This is for the Blender 2.6 API. There are two problems: 1. When I import a single animation frame from my animation file to Blender, all bones look fine. But when I import multiple (all of the ...
2
votes
1answer
28 views

DX11 Camera not working properly

I'm currently trying to implement a ArcBall Camera which should fly around a given XMFLOAT3 position stored in a cb with a spezified distance to the position. I used the code from Allen Sherrod for ...
1
vote
1answer
72 views

Rotating a 4D matrix about the Y axis with an X-Z vector

I should mention that I'm pretty new to Matrices and will probably need a layman's answer to my question. I have a 4D matrix which represents the rotation of an object in 3D space. I have a ...
1
vote
2answers
88 views

Get the difference between 2 matrices

Hi I'm using C# and MonoGame, and have the world matrices of 2 objects. I need to get the difference between them, so I can effectively parent the second object onto the first. The aim is to get to a ...
3
votes
3answers
2k views

Basic tutorial/introduction for 3d matrices, idealy in c++, without openGl or directX [closed]

I am wondering if there is a simple tutorial that covers the basics of how to initialize rotation, translation and projection matrices, and how to multiply them, and how to get the screen coordinates ...
3
votes
2answers
2k views

Identity matrix, What does it 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
1answer
49 views

Extract a rotation matrix given a camera direction (vector) and a up vector for the camera?

I am having some issues constructing a rotation matrix from a camera direction vector. The Up vector is computed from the camera direction as such: up = cross(cross(direc,(0,1,0)),direc) How do i ...
0
votes
2answers
47 views

Fastest way to neutralize scale in the transform matrix?

Let's assume we have 4x4 3D transformation matrix, that is the result of scale, rotation, and translation transforms. How to set its scale to (1,1,1) in the fastest way? Assume also that the matrix is ...
1
vote
2answers
173 views

Cumulative transformation matrices for hierarchical object transformations

I'm having a small issue with my design for hierarchical 3D objects. I'll try to sum things up concisely. Every object has a vector3 for its position, scale, and rotation, as well as a std::vector of ...
1
vote
1answer
39 views

How to compute a transformation matrix that describes each position and rotation on a sphere?

I am having an issue constructing my transformation matrices, for this sphere problem. I know the 3d coordinate of the center, and the radius of, the sphere. Since I know the radius and center ...
0
votes
2answers
48 views

OpenGL perspective matrix far plane

The near plane clips at exactly the value I set just fine but instead of clipping at 1000 the far plane clips at 1. Here is the code for the projection matrix: public static Matrix4f perspective(...
1
vote
1answer
46 views

What are projection independent ways of determining whether a normal is facing the viewer?

A position v and normal n are given in world coordinates. Also there is a view matrix V for world-eye coordinate transition and a projection matrix P for eye-ndc transition. I would like to determine, ...
0
votes
0answers
37 views

How to spin a 2D quad in place using only matrices?

In short, I have a textured 2D quad (a sprite). I would like to rotate/spin it about the z-axis (coming out of the screen) using nothing but matrices. If I do the following to a transform with scale ...
0
votes
1answer
117 views

Mode 7 in xna/monogame

I want achieve a view like Mode 7 from snes games where the closer textures get stretched out more and more far away textures look smaller. Something like this: What I have in my project at the ...
4
votes
1answer
138 views

How can I approximate an “opening fan”-transformation?

Is there a way to—with matrices—transform something as if opening the image on a Japanese folding fan? Image from Wikimedia Commons. I'm at a loss of what to call it, so pointers towards avenues of ...
1
vote
0answers
49 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 ...
0
votes
1answer
167 views

How do you build a rotation matrix from a normalized vector?

I'm trying to find the correct way to build a rotation matrix from a unit vector. I have two arbitrary points in space (p1 and p2), and I'm trying to create the vertices for a rectangle to span ...
29
votes
6answers
7k 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
0answers
40 views

How to Implement a 2d camera object for a side scroller game

Ok so Heres the problem. I'm Using c++ with sfml for graphics and box2d for physics. I've tried an ultra simple cam movement in the past where i lock the player to the center of the screen and offset ...
1
vote
1answer
131 views

Using glm to rotate the modelview matrix based on the cursor position

I am rendering a 3D model of an object, and I want the user to be able to rotate around that object by dragging the mouse. To do this, I want to use the cursor position to continually update the ...
0
votes
0answers
20 views

JBullet & LWJGL Rendering objects with jbullet transform

I tried to render objects with jbullet matrix transform. Its something like that: get float array where is stored matrix then put it to floatbuffer and load to Matrix4f using load() function. Use ...
0
votes
1answer
523 views

libgdx - Box2d debug draw not correct

I have a problem where the bodies in my debug draw does not draw correctly, take a look: As you can see, there is some space between the dynamic body and the ground. I have checked the contact ...
0
votes
1answer
82 views

Projection Matrix Breaks My Rectangle

This is my vertex shader, shown below. #version 330 core in vec3 a_position; in vec4 a_colour; // FOV = 70, near plane = 0.1, far plane = 1000 const mat4 u_projection = mat4( 1.428148, 0.0, 0.0,...
1
vote
1answer
142 views

OpenGL Arc-Ball Camera Yaw Pitch GLM::Rotate

I'm currently working on a small Voxel-Editor Project. In the editor, I plan on using an Arc-Ball camera which rotate around the model. My camera is currently working but in an odd way. I can't seem ...
2
votes
1answer
58 views

Recap on how a camera works in 3d Space?

This may be marked as a duplicate, but I have been trouble thinking about a camera. I understand that there is a "camera transform," or view matrix. However, this is multiplied with every vertex in ...
0
votes
1answer
129 views

Convert transform from world to local space

I have a hierarchical node system. Given a world space transform, I need to obtain the transform for a specific node in local space. My Node class has the following method. public void worldToLocal(...
2
votes
2answers
57 views

Strange behavior with transformation matrix

I'm fairly new to transformation matrices. I'm using them to translate and rotate nodes and their child nodes. The following code works when applied once, but shows strange behavior when applied many ...
1
vote
2answers
159 views

How to rotate camera using mouse?

I'm looking for a basic example of rotating camera using the mouse. the only problem is I'm not sure of how to rotating the camera around it target. should i do this by an algorithm or is there a ...
-1
votes
2answers
87 views

Rotation, what is the Matrix?

From a previous question, thank you very much by the way, but what on earth is the Matrix of? I'm very new to Mono/XNA and finding any meaningful documentation is practically impossible. point = ...
0
votes
0answers
29 views

Rotate object from an origin using a transformation matrix

I'm making a project in lib GDX and I want to rotate an object by changing the transform matrix of the sprite batch to one that rotates an object rendered on screen a given number of degrees from a ...
0
votes
1answer
96 views

Rotate heading relative to agent's local space

I'm having a little trouble translating a point in my game's world space to an object's local space. I have a cannon in my game with a normalized heading vector that's always supposed to point in the ...
2
votes
2answers
1k views

How to do directional per fragment lighting in world space?

I am attempting to create a GLSL shader for simple, per-fragment directional light. So far, after following many tutorials, I have continually ran into the issue: my light is specified in world ...
4
votes
1answer
100 views

Do matrix manipulations for 3D graphics ever produce singular matrices?

A singular matrix is a matrix that cannot be inverted. The vecmath library, for example, throws a SingularMatrixException if you try to invert a singular matrix. I think I understand what singular ...
0
votes
0answers
12 views

Collision Hull not Transformed Correctly

My collision hulls aren't aligned after my "engine" digests them. I used Spine to create my content. So here is the hierarchical model of my bones. Where Root, LoadGame, NewGame, QuitGame, and ...
1
vote
1answer
57 views

What is more efficient: Using matrix translation to move a character, or using a vector/scalar?

In 2D or 3D, matrix transformations are used for rotation, scaling, and sheering. However, when it comes to movement, should I go out of my way to use and implement scalar/vector movement, or just ...
1
vote
1answer
56 views

Terminology for the way Transformation Matrix Data is treated

I recently asked a question at math stack exchange and realize a similar questions is more suited for this forum, but the original is here: http://math.stackexchange.com/questions/1526601/terminology-...
2
votes
1answer
406 views

What is the correct multiplication order for a 2D matrix?

I'm currently trying to create a camera and entity/model matrix for my 2D game similar to that of Unity3D. I've already tried to find answers to this question on stackoverflow/gamedev but i couldn't ...
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
33 views

Last Row of the perspective projection matrix

Could you explain to me what is the purpose of -1 in the last row of the gl_projection matrix? And how it affects the perspective division step ?
3
votes
1answer
49 views

How can I get projected coordinates of vertex on screen

I want to check picking for faces and for that I need projected X Y coordinates of my vertexes in -1 to 1 range: For that I multiply my vertex array with matrices and then get projected triangle ...
0
votes
0answers
74 views

Tweening back from arbitrary 3D rotation in javascript

I'm using a 3D javascript library to rotate the vertex of a 3D object with a classic 3x3 matrix, to an arbitrary angle in the 3D space, as depicted in the image below. For example, a first ...