I've been meaning to start a series exploring the maths and science behind the software we use to create art and effects in VFX and CGI. As a physics graduate and aspiring VFX artist, I'm fascinated by how much of what I learnt in my degree that I recognise in the powerful programs that I use almost daily. In this first article we're going to start somewhere simple but fundamental with the Cartesian system, vectors and scalars.
The Cartesian system is the basis for the virtual 3D spaces we see in many 3D programs. We have 3 'axes' called x, y and z which are analogous to directions. These directions depend on where you're facing but generally X gives left and right, Y gives front and back and z gives up and down. We use numbers to measure how far along these axes(from the centre) an object might be which is more commonly known as a object's location.
Which brings us to vectors. A location in 3D space is an example of a vector. It is a value represented by a magnitude and direction. Scalars in comparison are only ever singular values that only describe how much of something there is. It might be unusual to think of a value as having a direction. The direction of a value is given by it's sign, either positive or negative.
For example, if we have a sphere with a location of (5, -5, 0) then the sphere is 5 units in the positive X direction which is to the right of the origin. It is also 5 units in the negative Y direction which is 5 units back from the X axis. We also have 0 units in the z direction which means the sphere is at the centre of the z axis which you could consider 'ground level'. I say 'could' because most objects are defined by having their origin at their centre so the bottom half of our sphere is going through the 'floor'. Some other examples of vectors are velocities, rotations and gravity.
At this juncture, you might be thinking about vector3s which are also vectors, they just use 3 values to describe something like a location. Many single value vectors can also be expressed as vector3s, such as gravity which as a vector3 if (0, 0, -9.81) which is often shortened to just -9.81. Gravity is a negative value because, on Earth, it always acts downward towards the floor and the centre of mass of the Earth. Gravity keeps objects and our feet on the ground. If gravity were a positive value we'd never return to the ground and simply float away.
Some examples of scalars are length, mass and time. Temperature is also a scalar. You might point out temperature has negative and positive values but these signs do not indicate a direction. In the case of temperature any negative values are due to how a temperature scale is defined. There are at least 3 commonly used: Celsius, Fahrenheit and Kelvin. A negative temperature in Celsius might be positive in Fahrenheit. These values are equivalent and are equally correct. Celsius, Fahrenheit and Kelvin are all arbitrary scales. If you so chose, you could define your own temperature scale. For example, celsius is based on the freezing and boiling point of water assigned to the values of 0 degrees and 100 degrees respectively. Kelvin is defined by the absolute coldest temperature possible being 0 degrees and so the Kelvin scale doesn't use negative values.
So, now you know scalars are quantities and vectors are quantities that also have a direction. You also now know that the Cartesian system is behind those funny grids and x, y, z labels in the viewports of your 3D programs. We started somewhere relatively simple but fundamental.
If you have any questions or feedback about this article or if you have any suggestions for agrid particular area of VFX or CG that you'd like to learn a little of the science or mathematics of, please email me at steambeanblog@gmail.com.
Take care,
- Kit