Understanding Perspective Matrixes in (simpler english) (WEBGL)/(OPENGL)

Understanding Perspective Matrixes in (simpler english) (WEBGL)/(OPENGL)

Channel:
Subscribers:
400
Published on ● Video Link: https://www.youtube.com/watch?v=Wko8QuFlxIA



Duration: 25:32
78 views
0


Absorbing and reflecting this video
I discuss in much simpler english
(if you've been using opengl for a tad bit)
you'll understand this but if not you should be able to understand
this if you know Cartesian.

Basically the idea with perspective projection

your clipping and or attaching the znear and or zfar plane on the x (width) , y (height) and z (depth) axis with the clipping and perspective volume which is determined by the distance between zfar and znear planes but the equations are weird and confusing.

First lets understand the matrix :

var matrix = [
xx, xy, xz, xw,
yx, yy, yz, yw,
zx , zy, zz, zw,
wx, wy, wz, ww
];

Now depending on if it's row or column order
will determine which w's are used for translation
in this case for webgl row is

var matrix = [
xx, xy, xz, xw,
yx, yy, yz, yw,
zx , zy, zz, zw,
(wx, wy, wz, ww)
];

if it was column then it would be

var matrix = [
xx, xy, xz, (xw,
yx, yy, yz, yw,
zx , zy, zz, zw,
wx, wy, wz, ww)
];


To create the actual plane you use variables

top 1.0,
bottom -1.0
left -1.0
right 1.0

on the xz and yz part of the matrix divided by the width and height variables .

width = 1.0
height = 1.0

then all the zfar and znear equations are as follows

var PersMat = [
//ROW 1
znear / width / 4.0 * zoomfactor, 0.0, left+right/width/2, 0.0,
//ROW 2
0.0, znear / height / 4.0 * zoomfactor , top+bottom/height/2, 0.0,
//ROW 3
0.0, 0.0, - (zfar + znear) / (zfar - znear), 2*zfar*znear / zfar - znear,
// ROW 4
0.0, 0.0, -1.0, 0.0
];


Hope that helps.







Tags:
Dominic
Hughes
energy
perspective
projecton
matrix
simplified
over
simple
much
easier
to
understand
webgl
c++
understanding
4x4
znear
zfar
plane
top
left
bottom
right
opengl
shaders
rotation
translation
uniform
compile
link
attach
equation
sine
cosine