Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [projection-matrix]

The tag has no usage guidance.

0
votes
1answer
241 views

From screen space to world space for a 2D game

I'm making a 2D game and I want the user to be able to position an object in the world using mouse input. After a while I found an answer to 'OpenGL Math - Projecting Screen space to World space ...
1
vote
0answers
33 views

2D pixels change size when scrolling [duplicate]

I'm working on a 2D side-scroller, OpenGL, pixel art. And I'm having trouble getting the pixels to remain square when scrolling the camera. By that I mean, when scrolling the camera at low speed when ...
0
votes
0answers
60 views

Sampling the depth buffer and normalizing to [0,1] (DirectX)

I'm trying to visualize (for debugging purposes) the depth of a scene on a textured quad (I want to display the depth of a water pond onto the surface of the water). So what I'm doing is rendering the ...
0
votes
2answers
47 views

How to keep an object in a certain part of the camera view?

I have a 3d camera that is viewing a character that is moving. As the character is moving i want the camera to adjust itself so as to keep the character in the left third of the camera view. I ...
0
votes
1answer
38 views

Why are the vertices from a mesh not transforming using a camera?

I am able to use a camera class to change the view and rotation of a simple quad, so I know it works, but when I move on to a more advanced geometry, such as a mesh, I am unable to affect the ...
1
vote
2answers
582 views

libGDX - orthographic camera and world units

I've followed the advice in this post to handle world/screen coordinates, but I'm getting results I don't quite understand, as I'm not terribly good in math. So, when I use this code: ...
1
vote
1answer
175 views

set zfar/znear in openGL using shaders (QT env)

I have a QT canvas and I'm using shaders to build my scence. I've set the camera image plane at some position, and would like to view object from the image plane to infinity. How do I set the zfar and ...
3
votes
0answers
691 views

Deproject Screen To World Coordinates (Unreal Engine 4.15)

I am working on a small game in Unreal Engine 4.15 using blueprints only and encountered a behaviour I don't understand. The game is based on the Top Down Example. As I'd like to teleport an actor ...
2
votes
1answer
52 views

What are some standard mathematical tests for projection matrices?

I'm trying to double check my math in my projection matrices. I'm thinking about "unit tests" when I ask this. I'm looking for 4 or 5 unit tests that would be appropriate to give one confidence that ...
0
votes
1answer
174 views

Problem calculating screen point for a point in a 3D world with view matrix and projection matrix

I am trying to calculate the 2D screen point of a 3D world position. For this I use the multiplication ViewMatrix * ProjectionMatrix. But I am not getting good ...
7
votes
0answers
57 views

How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape?

SOURCE : http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Mitchell_LightShafts.pdf This process is part of creating light draft effect. And I am suggested to do the described process in ...
4
votes
1answer
82 views

OpenGL Perspective Issue

I'm trying to troubleshoot a problem with my simple OpenGL test program, which I've written in C. I've written some math routines to do the matrix manipulation, but even after copying known working ...
3
votes
2answers
827 views

360 degree video of my OpenGL game

I want to make a 360 degree video of my OpenGL game. Concerning the rendering: Is it enough to render it in OpenGL with a specific projection matrix? If yes, which one? Or can I render it into a cube ...
1
vote
0answers
44 views

Convert box to matrix

I have a box (non-rectangular cuboid?) and would like to convert it to a matrix such that when a point inside the box is multiplied by the matrix, a vector is returned that describes the relative ...
3
votes
1answer
3k views

libGDX - Why do I have to use camera.setToOrtho what does it do?

I am very confused about camera matrices and I don't know where to start my studying. Maybe I have to study OpenGL, but I don't know C++ ... Ok so I have a camera, Box2d world and a Box2d body. <...
1
vote
0answers
445 views

How to achieve the top-down (oblique) projection of textures using an OrthographicCamera?

This question is related to (How to calculate the initial velocity of projectile motion by a given distance and angle from point A to B) question. Details In the below image is the graphical ...
1
vote
1answer
73 views

2D World Mouse Coordinates - Matrices

I'm trying to get the world coordinates out of a mouse click. Currently I'm doing the following: ...
0
votes
1answer
120 views

Calculate camera target

How calculate camera target position, if I have front/back planes, camera transformation matrix and camera lens length?
-1
votes
1answer
613 views

Project camera-to-pixel ray in world coordinates

I'm trying to implement a very simple ray tracing function but I have a problem with projecting the camera ray (from camera to pixel) to the world space. In the screen coordinates have the pixel ...
0
votes
1answer
54 views

Does a Standard Exist for Game Entity View Frustums

I was just recently adding the ability for my in-game entities to have their own Frustums, with the intentions of making them able to see enemies later down the road of my development cycle. My custom ...
2
votes
0answers
349 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 ...
1
vote
1answer
85 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 ...
0
votes
1answer
124 views

Projection Matrix Breaks My Rectangle

This is my vertex shader, shown below. ...
1
vote
1answer
143 views

HLSL pixel inside a view (cascaded shadowmapping)

I'm figuring out shadowmapping in HLSL (see also this question). I understand that I need projection matrices for each cascading shadowmap. I use this code to create the projections: ...
1
vote
1answer
462 views

Converting normalized device coordinates to world space coordinates flipping my sprites

I'm trying to convert my game's camera system to use world space coordinates rather than OpenGL's default normalized device coordinates, however in doing so my sprites are being rendered improperly as ...
1
vote
1answer
99 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 ?
2
votes
1answer
88 views

Shaders wont bind to the uniform block

I'm having an issue with interface block binding. Example shader: ...
12
votes
2answers
2k views

Why do we need a fourth coordinate to divide by z?

I read the response here: What does the graphics card do with the fourth element of a vector as the final position? "The fourth component is a trick to keep track of perspective projection. When ...
5
votes
2answers
150 views

How do I create a half-ortho half-perspective projection matrix

I've been trying to make a formula for the projection matrix where your vertical axis is projected orthographically but your horizontal axis will have perspective to it. So the view frustum would ...
3
votes
1answer
405 views

OpenGL: How to map point inside frustrum to normal device coordinates (NDC)?

I read this article http://www.songho.ca/opengl/gl_projectionmatrix.html. It's explain how calculate projection matrix coefficients. But I completely can't understand how author perform mapping from ...
10
votes
5answers
2k views

How do I correctly project a point behind the camera?

I am making a 3D game in which I put an exclamation marker above points of interest. In order to find out where in the 2D screen should I put my marker, I am manually projecting the 3D point where ...
2
votes
2answers
7k views

How can I set up an intuitive perspective projection/view matrix combination in OpenGL, using GLM?

Could anyone help me set up an intuitive perspective camera matrix using OpenGL and the GLM library? By "intuitive" I mean that I want the camera to be looking at the middle of the screen down the -Z ...
1
vote
2answers
562 views

OpenGL: Is it efficient ok to glPushMatrix, plMultMatrix, plPopMatrix for every object in my scene?

I'm very new to opengl, and I might not fully understand the openGL matrix projection stack thing. So, I have about 300 'objects' in my scene, each with their own position/rotation, and I want to ...
1
vote
0answers
992 views

How can I get shadows to appear correctly when using a custom projection matrix?

EDIT: This has been officially marked as a bug in Unity. If anyone else has this issue, you can vote here for Unity to fix it. As mentioned in this thread, I'm using a custom projection matrix in ...
2
votes
1answer
387 views

Why does the projection matrix transform object points into a unit cube in computer graphics?

This semester I both took a computer vision and a computer graphics seminar. But only now before the exams I realize that there seems to be a fundamental difference between projection in both topics. ...
0
votes
2answers
798 views

Z-Value of clip-space position is always 1.0

I render a lot of quads on the screen into z direction (20 x 2000). I want to get the depth value in a final render target. But it looks like z is always 1.0f. I checked the result with the OpenGL ...
1
vote
1answer
244 views

How to position a Weapons model in a first person shooter with XNA

I am building a first person shooter and positioning the weapons is hard. I am trying to get the bat to look like you are holding it but I keep trying things and they don't appear in the positions I ...
1
vote
2answers
5k views

How can I pass a std::vector<Vector3f> to my shader?

I have a Vector3f type which has x, y, and z properties. ...
3
votes
1answer
844 views

Offset a camera/render without changing perspective

I need to offset a render so that the perspective / vanishing point doesn't change. Or another way to look at it is that I need to adjust the vanishing point in my view so that instead of being at 0,...