Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

View, World & Projection Matrices

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Wrath87   Members   

110
Like
0Likes
Like

Posted 18 April 2012 - 04:17 PM

Hi!

I'm struggling to understand to goal of the mentioned matrices. I only know the meaning behind the World matrix. If I get that right that looks something like this:
Every model has it's own coordinate system wich occasionally may differ from the one we use on our programs. With the WorldMatrix we can convert the model's vertices to our world position with a simple multiplication: mul(vertex.position, worldMatrix);

Now with the other two I have no idea what to do. Could someone give me a slight explanation what are they good for and why?

Thanks,
Joe

#2 FLeBlanc   Members   

3137
Like
0Likes
Like

Posted 18 April 2012 - 04:36 PM

Model (or world) matrix is used for transforming an individual node or object within the world. View matrix is for transforming the world relative to the camera view, so that the objects that are supposed to be visible as determined by the camera are transformed into the view frustum. The projection matrix is responsible for "flattening" the visible frustum and fitting it to the device coordinates of the screen.

#3 Lauris Kaplinski   Members   

841
Like
0Likes
Like

Posted 19 April 2012 - 08:15 AM

You can think about the view matrix the following way:
Camera is just one object in your world. I.e. it has it's own local coordinate system (0 is at camera center, Z axis is oriented in camera direction, X is usually horizontal). Let's call it camera matrix.
Now camera matrix would allow you to transform camera vertexes to world coordinate system. But you need to do the reverse - transform world vertexes to camera coordinate system (the projection to 2D image happens relative to camera, not world).
For that you use the inverse of camera matrix - what is called the view matrix.

Projection is special kind of matrix, which transforms everything in the view frustum of camera into standardized clip space. To be more precise, it is not pure matrix multiplication but multiplication followed by perspective division. As a result the view frustum of camera will be converted to unit cube (-1,-1,-1 - 1,1,1 in case of OpenGL). At that stage polygons are clipped (regions outside of cube removed) and then rasterized to 2D.
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.