What to learn to be able to create a 3rd person camera and terrain.

Started by
3 comments, last by DragonBooster 10 years, 3 months ago

Hi guys.

As i have decided to program 3D graphics for my game with OpenGL, i am suprisingly picking it up quite quickly and i do not see how i got confused before, i created a notebook for myself which includes quick and understandable notes about OpenGL and 3D Graphics, since i just started i know how to create a basic triangle and add some special shading effect's with GLSL to make it look better.

Aside from that, what do i need to learn to create a 3rd person camera? Does it involve matrix manipulation? Currently i want to create a point in space that is always on the player and the camera is focused on that point focusing on where that point is. I also want to create a one point so that i can switch camera angles for cutscenes and stuff like that. Here is a diagram of what i mean:

---------------

| ==== |

| | P | |

| | | |

| X ==== |

-----------------

Key:

X = Player

P = Point that the camera focuses on.

Also how would i create a terrain that is flat. I do not want to create a terrain that is lumpy because my game will be set in a City/Fururistic environement most of the time.

Any help would be highly appreciated.

Advertisement

There are multiple ways to do this. I personally prefer the cheap and easy way of doing it. Take a look at this tutorial written by swiftless: http://www.swiftless.com/tutorials/opengl/camera3.html

It uses legacy OpenGL (i.e. glTranslatef and glRotatef), but if you already have your own matrix rotation functions, you can easily replace the legacy/deprecated stuff.

If you prefer a quaternion based camera, take a look at this tutorial by dhpoware: http://www.dhpoware.com/demos/glThirdPersonCamera1.html (IIRC, it's quaternion based, at least the D3D version is).

Hope that helps.

Shogun.

Thank you very much for the resources. Just to say that i am pretty new to OpenGL and only know a little like using VBO's,VAO's and Shaders for a simple triangle. I just wanted to know the best most quickest and best way to implement a camera so that i can get an idea of how it work's. Thanks for the help though it was quite helpful.

My pleasure. I had a rather hard time finding tutorials on 3rd person cameras a few years back. Experimenting with rotation functions and searching google had me pounding my head on the nearest wall a few times.

Shogun.

Same with OpenGL, before i started i was confused and kept crashing with the code everywhere. I decided to try DirectX and it just was not for me and i noticed how much better i was being better off with OpenGL. What i did was go and look at some tutorials, look at the reference and I decided to make a bunch of notes about OpenGL and how it works and it helped me quite a lot to progress with OpenGL.

This topic is closed to new replies.

Advertisement