Questions tagged [glm]
GLM is a C++ math library based on the GLSL language.
150
questions
0
votes
1
answer
45
views
Vulkan Phong shader problem
Light increases its intensity as it come closer the origin model.
Vertex Shader:
...
0
votes
1
answer
109
views
glm::frustum vs glm::perspectiveFov
When I use glm::perspectiveFov(90.0f,512.0f,512.0f,1.0f,256.0f) I receive a working perspective projection with 90° in both x and y, as seen below (camera is in ...
0
votes
1
answer
93
views
Unprojecting screen space to world space stops working when camera not at origin
I'm trying to implement screen space to world space in my engine to allow object selection in editor. I understand that the process should essentially be the reverse of projection. So to go from world ...
0
votes
0
answers
53
views
Сollision detection c++
In the cube class I have its position and rotation. Also I have a collision check function:
...
0
votes
1
answer
57
views
Transforming a ray to NDC coordinates
I am trying to have ray tracing with a mesh using NanoRT and I want to be able to allow for a model transform on top of my view and projection transforms.
I have successfully transformed my ray from ...
0
votes
1
answer
82
views
glm::eulerAngles gives unexpected output for quaternion
I used the euler->mat4->quat to give the right result, but euler->quat gives the wrong result - is there something I did wrong?
...
1
vote
1
answer
334
views
Implementing a Maya-like orbit camera in Vulkan/OpenGL
I want to create an orbit camera with zooming, panning, and rotation. I used the following examples to create cameras:
https://stackoverflow.com/questions/54400422/how-to-implement-altmmb-camera-...
1
vote
1
answer
783
views
How do I increment a quaternion rotation in update()?
When working with rotations expressed as angles, it makes sense to be able do to something like
void GameLoop::update(){
pawn.rotation.x += 0.01;
}
And slowly ...
0
votes
0
answers
44
views
How to calculate angles after subsequent rotations?
I have a class that manipulates a model matrix in opengl:
...
1
vote
1
answer
518
views
How to make a concisely, elegantly, and human-friendly Quaternion camera?
I have spent three weeks struggling with the quaternion camera!
Now I have two Implementations. One has some kind of gimbal lock issue or something like that. Another one is totally anti-human ( I ...
1
vote
1
answer
639
views
How is the GLM '*' operator on quaternion and vec3 defined?
Using the definition of quaternion rotation given here:
So the equivalent code in GLM of the above formula would be like this:
...
1
vote
0
answers
129
views
Calculating bone transformation matrix for vertex skinning
I have an issue with calculating transformation matrices for animation mesh deformation using glm in c++
I have a class Bone which does the basic calculation which does have a current local position (...
1
vote
1
answer
629
views
Applying incremental rotation with quaternions: flickering or hesitating
I'm having a couple of problems while rotating an object every frame with GLM.
First problem
I'm trying to rotate the object with a small increase using quaternion multiplication.
...
0
votes
1
answer
202
views
NVidia Physx Get Orientation problem
For a game that I am developing I moved from Bullet physics to NVidia Physx. The problem that I have is the following. I used to have a translation from bullet's rigid body orientation quaternion to ...
0
votes
0
answers
587
views
What am I doing wrong with this GLM camera rotation?
I'm attempting a very basic camera with GLM in C++ that has full pitch and yaw rotation. The game I'm planning to make will eschew triangles in favor of flat scaled/rotated sprites to represent ...
2
votes
1
answer
240
views
Smoothing multiple combined vector translations
I am currently working on my arm/weapon rig for an fps game written in a custom engine. I am to the point where I am implementing the movement of the arms/weapon (hereby referred to as weapon), for ...
0
votes
1
answer
376
views
Why clip in clip space - confusion with Gribb-Hartmann clip plane extraction
I understand to extract clip planes from the perspective matrix one can follow the methodology laid out by Gribb-Hartman as documented here:
http://www.cs.otago.ac.nz/postgrads/alexis/planeExtraction....
0
votes
1
answer
808
views
How do I calculate a matrix to render a mirror about a plane using GLM?
I've been trying to work out how to render a mirror for a while now, but a lot of resources I find either use very outdated tools I'm not familiar with, appear to be college slides referencing other ...
0
votes
1
answer
289
views
Calculating child world translation, rotation and scale
I'd like to know if it's possible to calculate a child's world translation, rotation and scale individually. I'm used to seeing devs resorting to matrix multiplication and then decomposition, like so:
...
0
votes
1
answer
215
views
Rotation matrix for a model where the forward axis is not +X
I'm trying to convert a normalized unit vector, representing an entity heading, into a rotation matrix for rendering.
The problem is that I'm using an (apparently) unusual forward vector for my ...
1
vote
1
answer
4k
views
Orthographic projection not showing a triangle
I just want to draw a simple triangle using GL_LINES primitive with orthographic projection matrix.
This is my vertices...
...
0
votes
0
answers
163
views
rotate sprite without stretching
I am attempting to rotate the sprites in my game, but they get stretched whenever it happens. I know that it is due to the screen not being square, but I can not figure out the correct way to ...
2
votes
1
answer
369
views
Matrix math in cascade shadow mapping
I am implementing cascade shadow mapping algorithm and currently stuck with matrix transformations - my AABBs, when projected in light space are pointing in the direction opposite to the light:
I was ...
0
votes
1
answer
578
views
Why is transform matrix order is reversed in my Scene graph implementation?
I have researched this a lot and so far all the examples, tutorials etc always use the following order: Scale * Rotate * Translate but for some reason this order must always be backwards in my Scene ...
0
votes
1
answer
902
views
Get world object transform relative to another object (potential parent)
I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic ...
0
votes
1
answer
182
views
How would I go about coloring marching cubes terrain?
I'm making a game with marching cubes terrain (I know very original idea) and I don't exactly know how to color it. I have a system to do it, I just need to know how to interpolate it where it's not ...
0
votes
1
answer
2k
views
convert world to screen coordinates with camera position and camera angle
Heyho :)
I'm trying to convert world coordinates to screen coordinates. I have available: fov, screen width, screen height, camera position, camera angle and obviously the position of the object in ...
1
vote
2
answers
1k
views
Rotating an object to face the same direction as another object
Feel like I should know this, maybe I'm just over thinking it. What I'm attempting to do is create a bullet hole plane/texture object on top of an existing mesh when a ray cast returns a hit point. I ...
3
votes
1
answer
2k
views
Euler angle and Quaternion conversion become weird when yaw is bigger than 90 degrees
I'm writing a camera which needs to change a quaternion to Euler angles than change them back, it only works when the yaw is less than 90 degrees, I wrote a example to check:
...
0
votes
1
answer
446
views
How do I calculate the bounding box for an ortho matrix for Cascaded shadow mapping?
I've been trying to get a cascaded shadow mapping system implemented on my engine, though it appears to be that the bounding boxes for the cascades aren't correct.
The part I'm interested in can be ...
1
vote
0
answers
92
views
Subtract a circle on a rectangle - OpenGL
I am writing a game using GLFW, GLEW, GLM and Bullet3 in C++. Its a Maze with holes. I am doing the floor with rectangles (wich is 2 GL_TRIANGLES).
I want to make some woles (circles), to the ball ...
0
votes
1
answer
246
views
Simplifying Camera Strafing
I have a camera that follows the position and direction of the player. These are updated using spin and velocity. The velocity is updated like so:
...
1
vote
1
answer
392
views
ASSIMP Skinning seems to be somewhat inverted
I'm currently implementing Skinning using Assimp as my asset importer. I've relied heavily on the following tutorial in order to skin meshes (http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html)...
0
votes
0
answers
1k
views
OpenGL viewport is stretched
For this project I am using GLFW, glad and glm.
My window looks like this:
The dimensions of the window are correct, but the viewport is stretched, making my square into a rectangle.
How do I use a ...
2
votes
1
answer
2k
views
GLM conversion from euler angles to quaternion and back does not hold
I am trying to convert the orientation of an OpenVR controller that I have stored as a glm::vec3 of Euler angles into a ...
2
votes
1
answer
1k
views
Storing transformations in game objects. (GLM, C++)
I'm currently writing a game engine from scratch for learning purposes. I just started implementing transformations. I know how they work in general but I'm not sure how to implement them efficiently ...
1
vote
1
answer
354
views
Opengl Airplane Camera
I am making a game in opengl and am trying to get a camera to follow an airplane. How can I get the camera to match the roll, pitch, and yaw of the plane? I am using glm as my math library. Thanks!
1
vote
1
answer
258
views
Find angle (slope) of collision plane?
I have implemented a collision and response system based on the famous "Improved Collision detection and Response" paper. However I'm having an issue with objects sliding backwards on slopes. I ...
0
votes
2
answers
614
views
Problem Implementing SAT Collision in 3D, OBB vs OBB
I am trying to implement SAT collision detection between 2 OBBs, however, I am getting a lot of false positives, can anyone help me figure out what I am doing wrong, thank you in advance.
This is my ...
1
vote
0
answers
95
views
Matrix for transforming a square to a quadrilateral
I have a square of points {<0, 0, 0>, <6, 0, 0>, <6,0, 6>, <0,0,6>}
(The square is placed at the origin in the xz plane in opengl).
Want to apply a transformation/s on the square and make ...
1
vote
1
answer
2k
views
how to use glm::rotate with a eulerangle?
I have a vec3 to represent my object's orientation/rotation but the glm::rotate method expects a quaternion. If I just convert ...
0
votes
1
answer
2k
views
GLFW - Camera rotation system
I need to make a camera rotation system similar to the one here
http://madebyevan.com/webgl-path-tracing/
To rotate, press the Left mouse button and drag. So far I figured a basic idea of how this ...
0
votes
0
answers
60
views
GLM: Camera attached to model moves in opposite direction from the model
I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world ...
1
vote
1
answer
3k
views
Camera Pitch, Yaw from View Matrix
I have a camera that works with Pitch and Yaw (no roll) and compute the look at matrix as following :
...
1
vote
0
answers
97
views
Get world position from Fragment Depth
I am trying to write the depth value in a G-buffer pass and then read it later to determine the world-space location of a fragment.
I have this shader which renders my G-buffer pass
...
1
vote
0
answers
221
views
Get world position from depth buffer
I have a buffer I am rendering gl_FragDepth (remapped to range 0-1) to a color buffer (instead of color) in OpenGL
I would like to, in a second pass, read this ...
0
votes
1
answer
3k
views
OpenGL calculate circle rotation around a given point
I'm trying to rotate an object around a certain point. If this point is the center of my world space I use the following algorithm:
glm::vec3 center is the center ...
0
votes
1
answer
109
views
Restore object right vector to horizontal position using quaternions
I'm fairly new in gamedev mathematics and i have a problem i cannot solve on my own.
I'm working on L-System tree generation engine and i'm having serious difficulities while trying to work out ...
0
votes
1
answer
337
views
Problem with FPS camera in Software Renderer
I am currently creating a software renderer (I know they aren't particularly useful anymore, it is purely from a knowledge and learning standpoint). I am using GLM and following OpenGL rules(as GLM is ...
-1
votes
1
answer
706
views
Get enemy/chaser object to face player object - OpenGL
My chaser object will not face the player object. It simply keeps spinning around and won't face the player.
...