Math for Game Developers - The Camera View Transform Matrix

  Рет қаралды 44,277

Jorge Rodriguez

Jorge Rodriguez

10 жыл бұрын

Construct a camera view matrix that transforms the scene into the local camera space, so we can hand it off to the graphics card to render.
Find the source code here: github.com/BSVino/MathForGame...
Question? Leave a comment below, or ask me on Twitter: / vinobs

Пікірлер: 44
@michaelbacigalupo4573
@michaelbacigalupo4573 10 жыл бұрын
OK, I died when you drew a little box around "shift". Good job keeping it interesting
@kaysentomas7772
@kaysentomas7772 2 жыл бұрын
you all probably dont care at all but does anybody know a trick to get back into an instagram account? I somehow lost my login password. I would love any help you can give me
@ishaanbeckham595
@ishaanbeckham595 2 жыл бұрын
@Kaysen Tomas instablaster :)
@kaysentomas7772
@kaysentomas7772 2 жыл бұрын
@Ishaan Beckham Thanks so much for your reply. I found the site thru google and I'm trying it out now. I see it takes a while so I will reply here later when my account password hopefully is recovered.
@kaysentomas7772
@kaysentomas7772 2 жыл бұрын
@Ishaan Beckham It worked and I actually got access to my account again. I'm so happy:D Thanks so much, you really help me out !
@ishaanbeckham595
@ishaanbeckham595 2 жыл бұрын
@Kaysen Tomas You are welcome :D
@Timo-iu4uc
@Timo-iu4uc 3 жыл бұрын
Thank you! You realy help me through my computer graphics class.
@zezinhokun
@zezinhokun 10 жыл бұрын
Man I'm from Brazil, please don't stop this.I study computer science and their lesson are AMAZING!! (I'm so sorry about my poor english).
@TrollAxeThrower
@TrollAxeThrower 6 жыл бұрын
Guys, there's an Elephant in the room.
@lordadamson
@lordadamson 8 жыл бұрын
Thank you man!
@Boston92swe
@Boston92swe 9 жыл бұрын
Question: The variable vecCamUp, didnt you already have that one ? from the parameter vecUp ?
@JorgeVinoRodriguez
@JorgeVinoRodriguez 9 жыл бұрын
Fredrik Westman Up for the camera isn't always the same as up for the world. Suppose the camera is looking down, then "up" for the camera is actually forward for everyone else. It's actually the up vector in the camera's local space. It points up for the camera, wherever that happens to be for other people. If the camera is upside down, its up vector could be down for others.
@Boston92swe
@Boston92swe 9 жыл бұрын
Jorge Rodriguez hmm I guess I am just a bit confused because at 9:14 you say the parameter is the camera up. Oh well, i take you word for it :) thanks for the reply :) !
@JorgeVinoRodriguez
@JorgeVinoRodriguez 9 жыл бұрын
Sorry, I don't always express things very well :)
@MrGwarpy
@MrGwarpy 2 жыл бұрын
There you are, Shift!
@hybrid686
@hybrid686 10 жыл бұрын
You are awesome (for _all_ of these videos)
@g0ndal
@g0ndal 10 жыл бұрын
thanks for the videos
@MrGameengineer
@MrGameengineer 10 жыл бұрын
Programmer art is awesome! Nice job on the video as always.
@guiltyshoes
@guiltyshoes 3 жыл бұрын
Beautiful elephant!
@sunoharachan3820
@sunoharachan3820 7 жыл бұрын
How is the forward vector x and the right vector z? The camera is at local space with x going to the right, so how is x going into the screen in world coordinates?
@JorgeVinoRodriguez
@JorgeVinoRodriguez 7 жыл бұрын
Not sure what part of the video you're talking about?
@sunoharachan3820
@sunoharachan3820 7 жыл бұрын
Jorge Rodriguez Hi Jorge, at 5:26 you draw the axises and you said that x is usually the forward vector, but isn't that direction the z axis?
@JorgeVinoRodriguez
@JorgeVinoRodriguez 7 жыл бұрын
Oh I see. In most videos I do I use Y as the up vector, X as the forward vector, Z as the right vector. Other engines use Z as the up vector. Some engines use Y as the forward vector. None of these are more 'correct' than the others, they're just different conventions. Ultimately you must transform the game's coordinate system into that which is required by the video card. In this case we assume that the video card wants -z to be forward, y up, x right. (Why -z forward and not something else? I imagine because they wanted it to be right-handed and also have x horizontal and y up like when you graph functions in Algebra class.) (Note: I say 'video card' but I actually should have said 'rendering API' since this is OpenGL's convention, but Direct3D has a different convention.) So we're exchanging between two different coordinate systems, one with -z forward, x right, y up (the API's desired system) and one with x forward, z right, y up (our game's convention) That's why I called the game's coordinates F R U instead of X Y Z, to avoid that confusion.
@JonBruce-BlueDev
@JonBruce-BlueDev 6 жыл бұрын
"Here you are, shift!" xDDD
@silvercarroll2352
@silvercarroll2352 3 жыл бұрын
Thanks :)
@procactus9109
@procactus9109 7 жыл бұрын
I don't want to know what kind of flea can eat from an elephant
@NeilRoy
@NeilRoy 8 жыл бұрын
By the way, I think that "SHIFT" that keeps popping up has to do with the software you're recording this with. It is probably set to show which keys you press, which is helpful in certain types of videos. There is probably a setting to disable that feature.
@JorgeVinoRodriguez
@JorgeVinoRodriguez 8 жыл бұрын
+Neil Roy It was my Wacom tablet driver. I've also seen it happen at work on artists computers. There's no way to disable it, it's just a crappy driver. I switched from Windows to Mac recently though so it doesn't show up in my more recent videos.
@NeilRoy
@NeilRoy 8 жыл бұрын
Jorge Rodriguez I had a feeling you used a tablet. I tried using photoshop to do what you do (just out of curiosity) with a mouse and it was sloppy at best. :) Great videos anyhow. I managed to use some of this to create "cheap frustum", where I only check if the objects are off the left or right sides (not the other planes). Mainly because it is a fairly simple game, and after some work I got it working and my frame rate jumped from 131FPS to over 800FPS... it was actually running too fast, I I implemented VSync for now, I will add in proper timing later. I also started to remember some of your math off by heart which I thought was nice for a change, I am starting to understand the relationships and WHY some of this math works (which is key to remembering it, at least for me). I'll sit and think about it and WHY it works until I "get it". ;)
@JorgeVinoRodriguez
@JorgeVinoRodriguez 8 жыл бұрын
+Neil Roy That is amazing! Nice work. I'm so happy to have helped :)
@quenjankosky7348
@quenjankosky7348 9 жыл бұрын
A question: I would like to find a way to make a "camera" using matrices. Im not using openGL, so the matrices aren't already there. Do you have any way to help?
@JorgeVinoRodriguez
@JorgeVinoRodriguez 9 жыл бұрын
Your engine will have matrices of some kind regardless of whether it uses OpenGL or something else. I don't know if I can speak to those details though because I probably don't know anything about the engine you use.
@quenjankosky7348
@quenjankosky7348 9 жыл бұрын
No no no no, Im making a simple engine for, brace yourself, my TI-82
@quenjankosky7348
@quenjankosky7348 9 жыл бұрын
Jorge Rodriguez So yeah, Im doing this in BASIC
@JorgeVinoRodriguez
@JorgeVinoRodriguez 9 жыл бұрын
Quentin Jankosky Holy bonkers how do you expect to do any camera stuff in that? You're probably better off not doing matrices but just a single 2d vector, unless you want to do rotations for some crazy reason.
@quenjankosky7348
@quenjankosky7348 9 жыл бұрын
Jorge Rodriguez I Enjoy using retro material, and it does work. Iv'e done 3D rotations and scaling on the TI-82, but I wanted to try making a first-person perspective shape explorer. This is why I'm asking for your help, and if it doesn't work there, I'll try it in C++ or something.
@AssassinGrudge
@AssassinGrudge 9 жыл бұрын
i don't get the invert part why do you have to invert it that's wierd ?
@JorgeVinoRodriguez
@JorgeVinoRodriguez 9 жыл бұрын
A matrix will transform a vector from its local space into the global space. If you invert it then it will transform a vector from global space into its local space. Try the video on coordinate systems: kzbin.info/www/bejne/Y3fRZZSqq5eBqbM
Math for Game Developers - Merry-Go-Round (Matrix Transformations)
7:22
Perspective Projection Matrix (Math for Game Developers)
29:13
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 193 МЛН
ДЕНЬ РОЖДЕНИЯ БАБУШКИ #shorts
00:19
Паша Осадчий
Рет қаралды 3,7 МЛН
어른의 힘으로만 할 수 있는 버블티 마시는법
00:15
진영민yeongmin
Рет қаралды 7 МЛН
La final estuvo difícil
00:34
Juan De Dios Pantoja
Рет қаралды 27 МЛН
The Camera Transform
47:18
UC Davis Academics
Рет қаралды 127 М.
Camera (View) Transform - Vulkan Game Engine Tutorial 14
11:48
Brendan Galea
Рет қаралды 22 М.
Explaining File Compression Formats
15:26
ExplainingComputers
Рет қаралды 137 М.
Matrices and Transformations - Math for Gamedev
15:31
FloatyMonkey
Рет қаралды 70 М.
Stable Diffusion in Code (AI Image Generation) - Computerphile
16:56
Computerphile
Рет қаралды 283 М.
Trigonometry - Easy to understand 3D animation
16:29
Physics Videos by Eugene Khutoryansky
Рет қаралды 1,1 МЛН
Enums considered harmful
9:23
Matt Pocock
Рет қаралды 191 М.
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 193 МЛН