4
votes
How does glm::lookAt produce a View Matrix?
Alright so upon looking into it further, here's how glm::lookAt produces a View Matrix:
Make a row-major ordered 4x4 Translation Matrix by negating the camera position, c:
...
4
votes
360 degree video of my OpenGL game
For performance reasons GPUs use some simplified approach to projection and assume that you want to project your geometry on a plane, so it works only for FOV angles < 180 deg.
You could try some ...
4
votes
Accepted
How do I create a localtoworldmatrix and worldtolocalmatrix in Godot?
In Godot a Transform3D has no concept of local or world. They are transformations between spaces, and what those spaces are depend on how you use them.
For a ...
3
votes
Accepted
Does a Standard Exist for Game Entity View Frustums
There isn't really a standard - it's going to be dictated by the needs of your gameplay.
For Splinter Cell, determining whether the player (or suspicious evidence) is seen by an AI is the heart of the ...
3
votes
Accepted
Projection Matrix Breaks My Rectangle
First of all, there's something fishy about your vertices. If we write them out properly:
...
2
votes
Accepted
Last Row of the perspective projection matrix
It's purpose is simple, the -1 gets multiplied with the z-value of any vertex you multiply the perspective matrix with.
So w = -z
Then during the perspective division each component (x, y, z, w) get'...
2
votes
Accepted
libGDX - Why do I have to use camera.setToOrtho what does it do?
setToOrtho does not set the projection type of the camera. An OrthographicCamera will always have an orthographic frustrum.
...
2
votes
OpenGL Perspective Issue
This was caused by an uninitialized variable being fed into the projection function:
...
2
votes
What are some standard mathematical tests for projection matrices?
A few ideas:
Any point in front of the camera along its central axis should get
mapped to (0, 0) after the perspective division.
Any point selected on / outside the camera's view frustum/prism should ...
Community wiki
2
votes
libGDX - orthographic camera and world units
I would recommend re-reading the post as I don't think you completely understand why you're setting up an orthographic camera.
The whole point of this is to move away from pixels and move towards ...
2
votes
Accepted
What exactly does XMMatrixPerspective{L,R}H do?
The DirectXMath library is all inline so you can look directly at the source.
For example, here is the C version of XMMatrixPerspectiveLH:
...
2
votes
Accepted
Can I get world-space z-near-plane vertices from projection matrix + z-near distance?
Thanks @DMGregory for the pointer in the comments.
I'm constructing a fullscreen quad at (x, y, -1, 1) in NDC. Notice z = -1 is ...
2
votes
Texture flipping behaviour
In OpenGL, by convention, the bottom-left, not top-left, is the origin (0,0). See also Why is OpenGL point (0,0) not in top-left corner of the screen?
2
votes
Accepted
How to visualize angle of projection in Oblique Parallel Projection?
On OP request, I'm posting the images I produced as answer.
These were made with Sketchup. They show a cube a plane where the cube is projected in an oblique projection. The blue sectors represent the ...
2
votes
Accepted
OpenGL frustum extraction
In openTK you need to transpose matrices to make it work.
Green lines are frustum in world space.
...
1
vote
How to set ortho projection / model view matrix without a camera?
Ended up going with this. Based on this documentation.
...
1
vote
Combining cylindrical Billboarding and aligning with velocity (unity)
Finally got it right ! Got it by trying to learn more about those matrices.
I needed to use the direction vector between particle position and camera as a forward vector
Here's the code for those who ...
1
vote
Confused about why my projection matrix works
Probably your intended nearplane and farplane variables mapped reversely.So it clipped out eveything that supposed to be rendered on the screen.
Possible Reasons
(Possible)There might be a transpose ...
1
vote
How does a game like Enter the Gungeon handle forward and backwards movement with their orthographic set up?
So, this screenshot (linked from the Reddit thread you linked) helps clear things up: https://twitter.com/DodgeRollGames/status/593625936131653632/photo/1
Their camera points directly down Z (...
1
vote
How to set the camera projection matrix so that its 4 rays always exactly hit the corners of a defined rectangle?
What I understand is that you are trying to create a non-stereoscopic background to represent a very far view in the background in a stereoscopic view.
I would try creating a multi-camera setup ...
1
vote
OpenGL orthographic projection rendering quarter of screen
I think I figured this out. I am calling glViewport with the window dimensions, but I believe it should be the framebuffer dimensions. In my case, the framebuffer was four times the size of the window....
1
vote
How to keep an object in a certain part of the camera view?
Take a look at the lookAt matrix : https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/lookat-function
I can't explain to you myself as I use a matrix library for this, but ...
1
vote
Why are the vertices from a mesh not transforming using a camera?
First of all, I haven't looked through all that code, but my first guess would be this line in the shader:
output.position = mul(worldViewProj, position);
If ...
1
vote
set zfar/znear in openGL using shaders (QT env)
You can't make OpenGL render to infinity. The depth buffer usually uses floats (it can use other types, but none of them can represent an infinite number of values), meaning it has a set precision. If ...
1
vote
Problem calculating screen point for a point in a 3D world with view matrix and projection matrix
Matrix multiplication is non-cumulative, aka A * B doesn't always equal to B * A. The order of the multiplications should be
<...
1
vote
How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape?
For a simple way of doing it, you’ll need two things:
First, you’re looking for the Sutherland-Hodgman Clipping algorithm, or some other type of clipping algorithm. Sutherland-Hodgman is very easy to ...
1
vote
360 degree video of my OpenGL game
You could also try Dual Paraboloid mapping. The idea is that you render your scene two times with a paraboloid projection - once for front and once for the back paraboloid. If you render the front and ...
1
vote
What are projection independent ways of determining whether a normal is facing the viewer?
You can get the position of the eye and test dot(eye-v, n)>0.
This checks that the angel between the viewing vector (from v to the eye) and the normal is less ...
1
vote
Accepted
2D World Mouse Coordinates - Matrices
Ok mystery solved.
The issue was because I wasn't normalizing the mouse x and y before applying the calculations. After doing the following everything started to work correctly:
...
1
vote
Calculate camera target
You can't.
This is assuming that you have used the following function
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
projection-matrix × 64opengl × 21
matrix × 18
projection × 16
mathematics × 12
camera × 12
unity × 6
c++ × 6
frustum × 6
3d × 5
perspective × 5
libgdx × 4
rendering × 4
transformation × 4
glm × 4
java × 3
directx × 3
coordinates × 3
linear-algebra × 3
2d × 2
xna × 2
shaders × 2
graphics × 2
glsl × 2
hlsl × 2