Skip to main content
↑
↓
Spherical forums
Community for the
Sphere game engine
New?
Contact Us
to register an account!
1 Hour
1 Day
1 Week
1 Month
Forever
Community
Help
Search
Recent Posts
Log in
Contact Us
News
Spherical
Facebook

Twitter

Discord chat
New?
Contact us
to register an account!
Creations
Programming
I finally understand matrices
1
Print
Topic: I finally understand matrices
(Read 2725 times)
previous topic

next topic
0 Members and 1 Guest are viewing this topic.
Fat Cerberus
Big Chungus
Posts: 2,765
*MUNCH*
Logged
Global Moderator
Sphere Developer
I finally understand matrices
April 30, 2016, 10:06:41 am
Matrices always confused me. I knew they were used for transformations in 3D rendering, and Sphere has the color matrix which allows similar tricks with RGB colors... but I never understood more than that, it all just seemed like black magic. Even the Wikipedia articles didn't helpall the algebraic equations just go right over my head. It wasn't until I was working on improving minisphere's ColorMatrix object last night that it finally clicked: All the matrix is doing is setting each component of the output (color, point in space, etc.) proportionally to one or more components in the input. This is why scaling factors are on the diagonal rather than filling the matrixeach component is set proportionally only to itself.
Basically it's a weighted average in N dimensions. It's quite elegant.
I also now understand why 3D matrices are 4x4 as well: In order for translation to work, you need to have a known constant factor somewhere. So you have the W coordinate, which is always 1 so that you can express translation as a product of it (W=1 * tx/ty/tz).
Why could I not find this layman's perspective on matrices anywhere else? Everywhere I looked showed the mathematical theory behind them, but not much else. If I had seen the description above, I would have understood immediately and then the math would have made more sense.
Last Edit
: April 30, 2016, 10:15:11 am by Lord English
Sphere 5.5.2

neoSphere
engine 
Cell
compiler 
SSj
debugger
forum thread

on GitHub
Radnen
Big Chungus
Posts: 1,439
Sphere Studio Developer
Logged
Senior Staff
Wise Warrior
Re: I finally understand matrices
Reply #1
–
April 30, 2016, 02:43:22 pm
Yeah, they are nifty. I took Linear Algebra in college and got a decent understanding, but I wasn't fully able to understand and appreciate them until I used them in code. Many 3D game engines like Unity use them to make sense of the world. It's really convenient too.
I'm actually excited a bit that matrices are going to be put into a proper Sphere API.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.
Spheresfml
here
Sphere Studio editor
here
N E O
Hero Poster
Posts: 585
Making it happen!
Logged
Administrator
Senior Administrator
Re: I finally understand matrices
Reply #2
–
April 30, 2016, 05:45:18 pm
In 2013 I had to implement matrix multiplication from scratch for a college assignment and was reading a Microsoft article on softwarebased 3D rendering at around the same time. I was familiarizing myself with byuu's phoenix GUI wrapper and took the opportunity to implement the MS examples in the software canvas
with much success
. That's when matrix maths clicked for me and I easily passed Linear/Matrix Algebra a semester or two later.
Flying Jester
Legendary Poster
Posts: 1,161
Logged
TurboSphere Developer
Re: I finally understand matrices
Reply #3
–
May 01, 2016, 12:04:42 am
All my teachers had skipped over them in high school, and I never quite got to the college classes that would have them (linear algebra, etc) before I switched away from a math major.
On the other hand, I've learned all about matrix math at my new job (along with beziers and nurbs curves). Seeing them in action actually makes them quite a lot easier to understand than any explanation I ever came across. Sadly, even in games it seems that people only explain them using mathematical notation, which is not helpful unless you basically already fully understand them in a mathematical context.
Learn some history?
The Flying Jester's Blog of Sorts
Fat Cerberus
Big Chungus
Posts: 2,765
*MUNCH*
Logged
Global Moderator
Sphere Developer
Re: I finally understand matrices
Reply #4
–
May 01, 2016, 01:32:33 am
Yeah, all I would have needed to understand what a transformation matrix was doing was for someone to say "weighted average in 3 dimensions" (not a fully accurate description, but close enough) and everything would have clicked. But as you said, the only explanation you ever get is the mathematical theory behind it, confusing equations and all. This kind of thing, incidentally, is what makes Wikipedia practically useless for learning anything new in math  everything is explained as though you're already basically a math wiz.
Interestingly enough, it was playing with
color matrices
that made me understand what 3D coordinate transforms were doing. I guess because RGB components are readily understood to be quantities (coordinates... not so much), so it's a lot easier to understand what the multiplication is really doing.
Sphere 5.5.2

neoSphere
engine 
Cell
compiler 
SSj
debugger
forum thread

on GitHub
1
Print
Creations
Programming
I finally understand matrices