Tagged Questions

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.

112 views

Matrix transformation

I have to find components of a matrix for 3D transformation. I have a first system in which transformations are made by multiplying: M1 = Scale x Rotation x Translation. I want to have the same ...
74 views

projection and matrices [closed]

Many games do just fine with two projections, that can be represented by a matrix (orthographic and linear perspective). But what about projections that can't be represented by a matrix? Can you ...
164 views

XNA 3D cube rotation problem

I am new to game programming and still trying to clear up my basics. I am stuck with a problem and unable to resolve on my own knowledge. I am trying to rotate a 3d cube in MonoGame (Similar to XNA) ...
658 views

How do I create a camera?

I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it. I have read about quaternions ...
184 views

projection / view matrix: the object is bigger than it should and depth does not affect vertices [closed]

I'm currently trying to write a C 3D software rendering engine from scratch just for fun and to have an insight on what OpenGL does behind the scene and what 90's programmers had to do on DOS. I have ...
664 views

How to rotate a set of points on z = 0 plane in 3-D, preserving pairwise distances?

I have a set of points double n[] on the plane z = 0. And I have another set of points double[] m on the plane ax + by + cz + d = 0. Length of n is equal to length of m. Also, euclidean distance ...
5k views

OpenGL - Calculating camera view matrix

Problem I am calculating the model, view and projection matrices independently to be used in my shader as follows: gl_Position = projection * view * model * vec4(in_Position, 1.0); When I try to ...
815 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 ...
446 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, ...
726 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 ...
2k 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 ...
2k 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 ...
126 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 ...
3k 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 [...
442 views

apply non-hierarchial transforms to hierarchial skeleton?

I use Blender3D, but the answer might not API-exclusive. I have some matrices I need to assign to PoseBones. The resulting pose looks fine when there is no bone hierarchy (parenting) and messed up ...
106 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 ...
65 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?
432 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 ...
503 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 ...
2k 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 ...
232 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(). ...
50 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) * Matrix.CreateRotationY(-0....
397 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; ...
1k 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 ...
85 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 ...
415 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 ...
1k 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 ...
692 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 ...
50 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 ...
1k 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 ...
114 views

Minimal Projection Matrix

i hope you can help me. I'm currently stuck at the creation process for projection matrices used by shadow maps. The problem is the following: I got the spot/directional light projectionmatrix/...
1k 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 ...
70 views

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 ...
412 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) * Matrix.CreateRotationX(...
629 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 ...
2k views

I have a Collada file with a rigged mesh. I've read the node tags in the library_visual_scenes tag and extracted the matrix for each node and stored everything in a hierarchical bone structure. My ...
4k views

Replace glTranslatef and glRotatef with matrixes

I'm not an opengl expert, and, as a novice, I prefer to practice a little bit with the old opengl just to be sure to understand correctly the basic concept of computer graphics before deal with ...
220 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: ...
198 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 : http://www.badlogicgames....
205 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 ...
4k 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 ...
39 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, -...
196 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 ...
321 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 ...
865 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 ...
215 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 ...
379 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 ...
260 views

what is order of implementation of matrix transforms?

What is the meaning of Tr*Sh*Ro*Sc =M ? How is matrix M written to form the graphic transformation : 1st Sc=Scale, 2nd: R=Rotate, 3rd : Sh=Shear 4th: T=Translate ? Is the matrix M above written ...