An array of numbers, symbols or expressions, arranged in row and columns. The numbers, symbols or expressions themselves are called elements or entries.
1
vote
2answers
154 views
Drawing cube in SharpDX, wrong perspective
I want to draw a cube. This is what i currently have:
As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size ...
3
votes
1answer
110 views
How to achieve cavalier projection using OpenGL fixed pipeline?
I want to make a quick demo program showing a cube, or a user loaded model, rotating in screen rendered with one of three projections: perspective, isometric and cavalier.
Using the fixed pipeline, ...
3
votes
3answers
94 views
How do I disassemble a 3x3 transformation matrix into rotation and scaling matrices?
I have a transformation matrix that rotates and scales. Is there any easy way to disassemble it into the original rotation and scaling matrices?
For instance:
M = R * S;
// I need f and h such that
...
1
vote
1answer
64 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 ...
2
votes
1answer
68 views
How do I check why is no output on screen?
I'm using OpenGL 3.3+, and I'm trying to create an orthographic projection to draw on screen. I have the model data in a buffer:
X Y
0, 0
50, 100
100, 0
And I create my Model-View-Projection ...
0
votes
1answer
29 views
Scaling/Rotating triangle
I have a Triangle class and a list of triangles representing my 3D model shape.
When I update the position, the rotation or the scale of my model, I also want my triangles list to be updated.
I ...
3
votes
1answer
58 views
What are the performance and size tradeoffs of Eigen::Transform versus Eigen::Matrix4f?
We finished migrating from DirectXMath to the Eigen math libraries for our 3D-Game Engine last week for portability reasons. After implementing transformations with matrices as we know them, we found ...
0
votes
2answers
139 views
GLSL: can i use matrix transformation functions in vertex shader?
I have a working OpenGL code where i render a terrain with some trees.
I am doing all the matrix mathematics on the client side.
Because of which the frame rate of my app is very low, around 25-30 ...
1
vote
2answers
50 views
Copying rotation between matrices
I have a transformed Matrix A and an another transformed Matrix B. How can I COPY the rotation of Matrix B to Matrix A?
2
votes
1answer
76 views
Issues with 2D Body/Limb system [closed]
In my game I have programmed Body and Limb classes. The Body is guaranteed to have an origin in the center of its sprite. The Body class has a List of children Limbs, each with their own offset. Every ...
1
vote
1answer
80 views
How to rotate vertices of 2D shape using a transform matrix?
I am making a top-down 2D game and am currently working on implementing improved collision using SAT. I programmed a Shape class with a Vector2 center that is its position in world space. On top of ...
2
votes
2answers
72 views
Frustum culling based on MVP matrix?
Tutorials on the internet usually say to extract plane data from MVP (model view projection) matrix (or VP?) and then test the bouding volume against each of the frustum planes. I've thought of a ...
0
votes
2answers
61 views
What dimensions should you use for a perspective projection frustum?
What dimensions should you use for a perspective projection frustum? Initially I created a perspective matrix based on the width and height of the screen, with a calculated zNear value based on a ...
0
votes
0answers
27 views
XNA - Link between Create Rotations matrices
A friend of mine have been coding some rotations on my XNA project, but the order of the matrices rotation are not good. Some are of form :
Matrix.CreateRotationZ(1.21f) * ...
2
votes
2answers
63 views
How to use camera transformation without depending on (1,-1) scale during spriteBatch.draw()
I am creating a 2D platformer type game in XNA.
I currently have a camera object, with a position/rotation/zoomlevel that I use to generate a transformation matrix to pass to SpriteBatch.Begin(). ...
0
votes
3answers
104 views
OpenGL: glRotatef cause performance drop while rotating -x and -y
I have made a rotating cube and I got some performance drops while using two glRotatef calls. So basically this code is giving me 80FPS:
//code 1
GLrotate_x += 0.4f;
GLrotate_y += 0.4f;
...
0
votes
0answers
55 views
Matrix Translate Camera has some sort of spiky movement
public class Camera2D
{
private Vector2 _position;
protected float _viewportHeight;
protected float _viewportWidth;
public Vector2 ScreenCenter;
protected Being _unit; // the sprite camera is ...
1
vote
1answer
78 views
The correct way to transform a ray with a matrix?
Playing with XNA Triangle Picking Sample I found out that it does not work well if you scale the world matrix of the objects you want to pick. When I dug into the implementation I found this comment ...
0
votes
1answer
69 views
Distorted LookAt When Looking Up or Down?
I have a weird problem and I have no idea what's going on with it.
Recently started doing some OpenGL programming, going pretty well, hit some rough spots but worked my way through them and otherwise ...
14
votes
4answers
1k 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
29 views
Checking if a object is blocking my view of a light (it's between light and camera)
I'm trying to determine, from a list of objects, which ones are blocking my view of a light. In other words: which ones are between the light and the camera. Coding in C++, using HPL1Engine.
This is ...
0
votes
1answer
74 views
Relative Position/Rotation calculation
I have 2 objects each with a 3x3 Matrix (Orientation) and a Vector3 (Translation). Both are relative to world coordinates.
How do I calculate the position and orientation of object B in relation to ...
2
votes
2answers
26 views
Derive direction in which a spot light emites its light from a projection matrix
First of all, sorry if my question sounds too basic or even makes no sense. I'm new with game development
I'm working with HPL1Engine, specifically, the lights parts. I need to know the direction in ...
0
votes
1answer
135 views
First person camera world matrix issue (in THREE.js and webGL)
I'm trying to create a Portal-like effect in webGL using THREE.js.
I have two scenes connected by a pair of portals. The view of the 2nd scene in rendered inside the 1st portal using stencils and ...
1
vote
0answers
96 views
How should matrix-based Parallax Scrolling work?
The question is at the end, as it requires a bit of context.
I'm not sure if my understanding, my code, or LibGDX's ParallaxCamera is wrong.
LibGDX's ParallaxCamera uses Matrix4s to achieve a ...
0
votes
0answers
96 views
Alter a model-view-projection matrix
I have a model-view-projection matrix created based upon my camera. Is it possible to make alterations to it after it was computed to affect the corners of the resulting camera frustrum? For example, ...
0
votes
1answer
255 views
Screen space decals, converting world to decal space
I'm trying to do screen space deferred decals following the presentation made by Pope Kim about SSDs in WH40K: Space Marine (link). I've gotten to the point where I can render a decal if the bounding ...
0
votes
0answers
52 views
“Blinking” graphical bug when rotating shadow matrix
So, we have implemented Krypton shadows into our code for our 2D game, and it's working beautifully. Only issue is that we're running into a bizarre graphical bug when rotating the shadows with the ...
6
votes
0answers
176 views
Rotation pitch/yaw reverse problems when picking a tile (2.5D) [closed]
Set-up: 3D world, isometric sprite rendering (4 fixed angles).
This transform matrix is used as camera:
_transform =
Matrix.CreateRotationZ(Roll) *
...
2
votes
1answer
115 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 ...
0
votes
3answers
118 views
How can I properly rotate a 2D vector in the “flipped” XNA client space?
In my 2d XNA game, because SpriteBatch treats world space as client space and has positive Y axis down and negative up, I've built my game's world space with that coordinate system too. However, I've ...
0
votes
1answer
174 views
XNA 2D Camera, zoom into player
My 2D camera follows the character fine without any zooming. However, when I tried adding a zoom feature using the Matrix.CreateScale(), the camera no longer follows the character properly.
public ...
2
votes
2answers
182 views
Why translation uses multiplication and not addition? [closed]
To translate an object from (x, y, z) to (a + x, b + y, c + z) it's done using:
OK, that's cool, but why would we multiply in the first place when we can add the two matrices directly as:
...
0
votes
1answer
74 views
How can I adjust the UVs of my quad so my texture isn't flipped?
My sprite geometry is reversed using matrix so that it is in the XZ plane. This results in the image used for the sprite to also be reversed, which I don't want:
(source : ...
2
votes
1answer
84 views
Light Space and Light Texture Space in shaders
I'm looking into material translucency and I'm working through some GPU Gems documentation (http://http.developer.nvidia.com/GPUGems/gpugems_ch16.html).
In Example 16-4 it references matrices for ...
14
votes
4answers
1k views
What does a matrix represent?
I began learning OpenGL recently and am having problems visualizing what matrices are and their role in computer graphics. Given the template of a 4x4 matrix like this:
I would assume that each ...
0
votes
0answers
38 views
Matrix transforms with SpriteBatch overloading - how do you rotate/zoom around a point? [duplicate]
I have a transform matrix which works as intended for game objects I want to be completely controlled by my camera:
_transform = Matrix.Identity *
Matrix.CreateTranslation(-_position.X, ...
0
votes
1answer
53 views
How to modify normal vectors with a tranformation matrix
Transformation is quite simple when it comes to Position or Color of the vertex, for Position just multiply matrix * vector and for color just don't do anything, but my question now is: How to handle ...
0
votes
2answers
144 views
Keep Mini map static after rotating / zooming with camera
Hi I am making a 2D game, where the Camera is able to rotate / zoom in or out on the camera focus (the player usually).
However my game also contains a mini-map, and so far whenever I have to rotate ...
3
votes
4answers
243 views
Why not use vectors to represent orientation?
From what I've read, people mostly use either quaternions or 3x3 matrices to represent 3D orientations, while plain vectors are used for angular velocity/momentum.
Since we can use vectors to ...
1
vote
1answer
91 views
Does a 2D Vector or 2x2 Matrix play any role in 2D Transformations?
I'm having trouble trying to figure out if a vec2 or mat2 class are used at all in transformations for 2D rendering. Vec2, apart from representing UVs, AFAIK, is relatively pointless in regards to ...
0
votes
1answer
64 views
Multiplying matrices in HLSL
I have code that calculates a position like this in HLSL:
output.ShadowPos = input.VertexPos;
output.ShadowPos = mul(output.ShadowPos, gWorld);
output.ShadowPos = mul(output.ShadowPos, ...
1
vote
2answers
86 views
Encode world matrix as 2 float4s?
On one of the slides of their presentation "Batch, Batch, Batch!" guys from NVidia suggest encoding animation matrices for pallet skinning into two float4s as:
• axis/angle
• ...
0
votes
1answer
39 views
Rotate final image with projection matrix
I'm trying to use space in my shadow (depth) maps in a more efficient way. If I could freely rotate the final image I get with projection matrix I could save a lot of pixels, but I don't know if it is ...
1
vote
1answer
72 views
How to make child transforms honor parent origin
I'm working on a 2D transform system that has the following requirements:
Transforms can have children
Transforms have anchor points/origins that offset them
Children should honor the parent's ...
4
votes
5answers
493 views
How to rotate an object around world aligned axes?
I have a Vector3 which has an euler angle for each axis.
Usually, when I want to create a rotation matrix I will use functions such as D3DXMatrixRotationX passing the respective angle from my ...
0
votes
0answers
49 views
W2S, worldtoscreen from Projection Matrix and View Matrix
After a couple of days of tremendous trial and error coding, I must give up:
I have a simple 3d program that I'm adding a visual layer to. Basically, I want to draw 2d icons and text over 3d objects ...
3
votes
1answer
212 views
How to move an object up and down like a wave?
I am trying to move my object up and down using cos and sin, but I have problem understanding how does the sin and cos work, so I can make my object move up and down like a wave frequently
Init Time ...
3
votes
2answers
459 views
Identity matrix. Confusion. What does it really do
I understand identity matrix is like multiplying to 1. But i can't really understand why would you multiply an a matrix that will only result to the same.
Also im messing up with an OpenGL code and ...
1
vote
1answer
164 views
Converting 3 axis vectors to a rotation matrix [closed]
I am trying to get a rotation matrix (in 3dsmax) from 3 vectors that form an axis (all 3 vectors are aligned by 90 degrees each other)
Somewhere I read that I could build a rotation matrix just by ...