Clone the sources: git clone --recurse-submodules github.com/emeiri/ogldev.git If you want to get the same version that was used in the video you can checkout the tag 'TUT_55_GLM_CAMERA'. Build on Windows: Open the Visual Studio solution: ogldev\Windows\ogldev_vs_2022\ogldev_vs_2022.sln Build the project 'OpenGL\Tutorials\Tutorial55_GLMCamera'
Very, very good explanation. Any time ago i was created my camera3d with quaternions. I worked hard and this camera works on the basis of quaternions. But in this video implementation of camera3d is more better. Masterful execution and code:)) Thanks for this video.
Really cool way of making this camera. I was used to Joey DeVries for a long time, this is a bit different but love the damping! Very fun thank you! 👍👍👍
👍 Another video. You're rolling. @10:00 "Notice the order. First view and then projection". That is indeed the order of multiplicating matrices. However, some newbee may be confused about how that order is shown. You firstly do select 'View', and secondly select "m_persProjection", but the line of code reads: first m_persProjection, and then View :) But yeah.. i had to write _some_ comment to help the algorithm. Cheers!
Thanks! What we are trying to accomplish is the following: P*(V*(W*v)) where v is the local space position of the vertex. In this video we skipped W but this is the general idea. Instead of multiplying each matrix individually we combine them together to a single matrix. The way that the evaluation works and how the operators are executed in the statement 'm_persProjection * View' is that it's as if View is multiplied first by the vertex and then projection. So it's written like that but the evaluation is from right to left.
thx very much, I was on the perspective projection matrix video today following the first tuto, but I was following with glm so I was tweaking a lot, it made me slow
if you still have issues with roll you can try to get the roll angle using dot of right with global up, and do another quaternion on Z axis to fix it: auto fix = glm::dot( camera_component.right, glm::vec3( 0, 1, 0 )); auto fix_quat = glm::normalize( glm::angleAxis(( float ) fix, glm::vec3( 0, 0, 1 ))); camera_component.orientation = glm::normalize((fix_quat) * camera_component.orientation );
Thanks for the feedback. I'm trying to follow up on your logic. You are calculating the dot product between the actual right vector and a constant up vector which is the cosine of the angle between them. This should be zero in most cases unless your right vector is "bad". Then you create a quaternion to pull the camera back to a natural position. Is my understanding correct? Is this an alternative solution to the SetUpVector function at the end of the video?
I have something very similar but instead of using glm::lookAt I use the inverse of the camera's position matrix, it lets you look upside down without doing the weird snappy thing and inverting all of your controls. I need it because I'm trying to make a space game but this is great for like 99% of applications
Thanks. The inverse of the camera position simply moves the camera to the origin. What about rotating the world so that the camera is aligned with the Z axis?
Hi Etay, great video, I have question though: In the CalcCameraOrientation function, for the DeltaQuat cast, why do change the component order for the vec3? Your component order is y,x,z. Why not xyz? Thanks, Rich
Yes, this is a combination of two quaternions: a rotation around 1,0,0 by the y-delta (y,0,0) and a rotation around 0,1,0 by the x-delta (0,x,0). Combine them together to get y,x,0.
i was watching one of your terrain lod videos but i wounder how does a skinned mesh lod works , especialy when a animation or animation controler is playing a sequence of keyframes for the skinned mesh , how does a the lod changes during such an event with skinned meshes?
I'm not sure how common it is to implement LOD on a skinned mesh. Skinning is mostly for humans, creatures, mechanical devices, etc. LOD is for terrains. Anyway, skinning is implemented in the vertex shader so you can still have an LOD system using tessellation which comes after the VS. The geomipmapping algorithm which I presented in the terrain series is probably not a good match for skinning but need to think more about it.
Hello iam Aswin, I have previously asked some doubts regarding game development. Thanks for your time in answering me. Iam in an very big confusion. Iam right now learning opengl and vulkan for game development. I have completed 19 vedios of your opengl beginner guide. I have also seeing many other youtubers vedio. But my confusion is that should I go with low level game dev or learn a game engine like unreal engine. As a upcomming computer science graduate, iam very passionate about learning game development from scratch. Will my passion endup in success or failure. My worries is not spending time and learning opengl but will the game made using opengl and vulkan match the graphics of unreal engine. Will the time which I put in give me something in return. U have far more experience in this field. So please to give suggestions on my thoughts.
You speak about totally different jobs, learning graphics (i.e. Vulkan / OpenGL / DirectX / Metal, and other low level technologies etc) will allow you to create game engines, improve performance of work on GPU (for games, film industry, artificial intelligence, etc), or even do scientific research on more beautiful or fast computer graphics algorithms. This path almost doesn't include any game development (i.e. making levels, game scripts, game balance, making story, etc), unless you make your own indie game from scratch. So if you seek the job of actually making games, you better learn the popular game engines, prototype your own small games, and seek a job position in game development. But if you're passionate about computer graphics, that's an awesome career path as well (and I enjoy every bit of it), it just that you won't probably make many games, but you'll be near the games, supporting them from low level
To expand on the other comments in this thread - if you plan to be a professional game developer then the question you need to ask yourself is: what's the most efficient way for me to develop this game which will provide the highest chances of completing the project successfully within the budget and time constraints? Since you (I guess) haven't completed any game yet either from scratch or using a game engine you may want to spend some time creating a prototype in both ways. I would assume that if you pick up your first Unity/Unreal tutorial you will be able to create a simple 3D game in a couple of weeks. As far as I know, most of the game developers these days choose this route. However, there are also many people who don't consider themselves great programmers and they go the game engine way simply to avoid the complexity of programming from scratch. If you do know OpenGL/Vulkan/DirectX you will have a unique advantage of being able to work on low level systems in companies that develop game using an in-house game engine and there are quite a few of those. Also try to avoid doing stuff from scratch more than once. You should build reusable components and systems that will provide you with an ever increasing library of code to help you jumpstart your next project more quickly. Bottom line, if you find graphics programming interesting then having knowledge of both OpenGL and one or two game engines will position you perfectly for many companies. If you are an indie game developer with a limited amount of time for your next game then a game engine is probably the safest bet. Hope this helps!
Thanks for all the people. All your answers helps me to get an good clarity. As of now, I have planned to spend time equally on learning both the opengl and the unreal engine. One small doubt, will the graphics of the game made using opengl, vulkan and directx will be equal to the graphics of unreal engine?. If not why plz since the game engine are made using these libraries right. Another one question, will AI replace the game programmers??? Once again! THANKS FOR ALL YOUR ANSWERS.
While Unreal engine is indeed based on an existing API which serves as its graphics backend, the difference is the level of techniques and algorithms that were implemented. You can watch videos from GDC on youtube where people talk about how they achieved the graphics that you see on today's AAA games. Regarding AI - I have no clue. Naturally some tasks can be done more quickly by AI but whether AI can replace the entire or most of the workforce? Can AI replace human creativity from this point forward?
Clone the sources:
git clone --recurse-submodules github.com/emeiri/ogldev.git
If you want to get the same version that was used in the video you can checkout the tag 'TUT_55_GLM_CAMERA'.
Build on Windows:
Open the Visual Studio solution: ogldev\Windows\ogldev_vs_2022\ogldev_vs_2022.sln
Build the project 'OpenGL\Tutorials\Tutorial55_GLMCamera'
Very, very good explanation. Any time ago i was created my camera3d with quaternions. I worked hard and this camera works on the basis of quaternions. But in this video implementation of camera3d is more better. Masterful execution and code:)) Thanks for this video.
You're welcome :-)
Really cool way of making this camera. I was used to Joey DeVries for a long time, this is a bit different but love the damping! Very fun thank you! 👍👍👍
You're welcome :-)
👍 Another video. You're rolling.
@10:00 "Notice the order. First view and then projection". That is indeed the order of multiplicating matrices.
However, some newbee may be confused about how that order is shown. You firstly do select 'View', and secondly select "m_persProjection", but the line of code reads: first m_persProjection, and then View :)
But yeah.. i had to write _some_ comment to help the algorithm. Cheers!
Thanks! What we are trying to accomplish is the following: P*(V*(W*v)) where v is the local space position of the vertex. In this video we skipped W but this is the general idea. Instead of multiplying each matrix individually we combine them together to a single matrix. The way that the evaluation works and how the operators are executed in the statement 'm_persProjection * View' is that it's as if View is multiplied first by the vertex and then projection. So it's written like that but the evaluation is from right to left.
Excellent video!, ❤
Thanks!
thx very much, I was on the perspective projection matrix video today following the first tuto, but I was following with glm so I was tweaking a lot, it made me slow
You're welcome :-)
if you still have issues with roll you can try to get the roll angle using dot of right with global up, and do another quaternion on Z axis to fix it:
auto fix = glm::dot( camera_component.right, glm::vec3( 0, 1, 0 ));
auto fix_quat = glm::normalize( glm::angleAxis(( float ) fix, glm::vec3( 0, 0, 1 )));
camera_component.orientation = glm::normalize((fix_quat) * camera_component.orientation );
Thanks for the feedback. I'm trying to follow up on your logic. You are calculating the dot product between the actual right vector and a constant up vector which is the cosine of the angle between them. This should be zero in most cases unless your right vector is "bad". Then you create a quaternion to pull the camera back to a natural position. Is my understanding correct? Is this an alternative solution to the SetUpVector function at the end of the video?
@@OGLDEV Exactly. This worked for me long time ago. I'm not a quaternion especialist although 😁
It's always good to have alternatives :-)
Ty
:-)
I have something very similar but instead of using glm::lookAt I use the inverse of the camera's position matrix, it lets you look upside down without doing the weird snappy thing and inverting all of your controls. I need it because I'm trying to make a space game but this is great for like 99% of applications
Thanks. The inverse of the camera position simply moves the camera to the origin. What about rotating the world so that the camera is aligned with the Z axis?
Hi Etay, great video, I have question though: In the CalcCameraOrientation function, for the DeltaQuat cast, why do change the component order for the vec3? Your component order is y,x,z. Why not xyz?
Thanks,
Rich
I think you answered it at 23:25, going through it again
Yes, this is a combination of two quaternions: a rotation around 1,0,0 by the y-delta (y,0,0) and a rotation around 0,1,0 by the x-delta (0,x,0). Combine them together to get y,x,0.
Got it, mouse x rotates on y up, mouse y rotates on x right
i was watching one of your terrain lod videos but i wounder how does a skinned mesh lod works , especialy when a animation or animation controler is playing a sequence of keyframes for the skinned mesh , how does a the lod changes during such an event with skinned meshes?
I'm not sure how common it is to implement LOD on a skinned mesh. Skinning is mostly for humans, creatures, mechanical devices, etc. LOD is for terrains. Anyway, skinning is implemented in the vertex shader so you can still have an LOD system using tessellation which comes after the VS. The geomipmapping algorithm which I presented in the terrain series is probably not a good match for skinning but need to think more about it.
@@OGLDEV ok thanks
Hello iam Aswin, I have previously asked some doubts regarding game development. Thanks for your time in answering me.
Iam in an very big confusion. Iam right now learning opengl and vulkan for game development. I have completed 19 vedios of your opengl beginner guide. I have also seeing many other youtubers vedio. But my confusion is that should I go with low level game dev or learn a game engine like unreal engine. As a upcomming computer science graduate, iam very passionate about learning game development from scratch. Will my passion endup in success or failure. My worries is not spending time and learning opengl but will the game made using opengl and vulkan match the graphics of unreal engine. Will the time which I put in give me something in return.
U have far more experience in this field. So please to give suggestions on my thoughts.
You speak about totally different jobs, learning graphics (i.e. Vulkan / OpenGL / DirectX / Metal, and other low level technologies etc) will allow you to create game engines, improve performance of work on GPU (for games, film industry, artificial intelligence, etc), or even do scientific research on more beautiful or fast computer graphics algorithms. This path almost doesn't include any game development (i.e. making levels, game scripts, game balance, making story, etc), unless you make your own indie game from scratch.
So if you seek the job of actually making games, you better learn the popular game engines, prototype your own small games, and seek a job position in game development.
But if you're passionate about computer graphics, that's an awesome career path as well (and I enjoy every bit of it), it just that you won't probably make many games, but you'll be near the games, supporting them from low level
It's different but cpp is transferable
To expand on the other comments in this thread - if you plan to be a professional game developer then the question you need to ask yourself is: what's the most efficient way for me to develop this game which will provide the highest chances of completing the project successfully within the budget and time constraints? Since you (I guess) haven't completed any game yet either from scratch or using a game engine you may want to spend some time creating a prototype in both ways. I would assume that if you pick up your first Unity/Unreal tutorial you will be able to create a simple 3D game in a couple of weeks. As far as I know, most of the game developers these days choose this route. However, there are also many people who don't consider themselves great programmers and they go the game engine way simply to avoid the complexity of programming from scratch. If you do know OpenGL/Vulkan/DirectX you will have a unique advantage of being able to work on low level systems in companies that develop game using an in-house game engine and there are quite a few of those. Also try to avoid doing stuff from scratch more than once. You should build reusable components and systems that will provide you with an ever increasing library of code to help you jumpstart your next project more quickly. Bottom line, if you find graphics programming interesting then having knowledge of both OpenGL and one or two game engines will position you perfectly for many companies. If you are an indie game developer with a limited amount of time for your next game then a game engine is probably the safest bet. Hope this helps!
Thanks for all the people. All your answers helps me to get an good clarity.
As of now, I have planned to spend time equally on learning both the opengl and the unreal engine. One small doubt, will the graphics of the game made using opengl, vulkan and directx will be equal to the graphics of unreal engine?. If not why plz since the game engine are made using these libraries right. Another one question, will AI replace the game programmers???
Once again! THANKS FOR ALL YOUR ANSWERS.
While Unreal engine is indeed based on an existing API which serves as its graphics backend, the difference is the level of techniques and algorithms that were implemented. You can watch videos from GDC on youtube where people talk about how they achieved the graphics that you see on today's AAA games. Regarding AI - I have no clue. Naturally some tasks can be done more quickly by AI but whether AI can replace the entire or most of the workforce? Can AI replace human creativity from this point forward?