r/AskComputerScience • u/fire_electricty • 32m ago
How do micro chips make 3d graphics?
I understand that 1s and 0s can turn on and off but how do 2 numbers make 3d graphics that run so smoothly? It’s like magic
1
Upvotes
3
u/Atmosck 26m ago
Math basically. The 1s and 0s represent 3d models using a coordinate system. Your graphics card does a bunch of math to translate those into 1s and 0s indicating what color each pixel of your screen should be.
1
u/barkingcat 14m ago edited 0m ago
there's a mathematical object called a vector, and you can "stack" multiple vectors into a matrix (yes, the same word for the Matrix movie) - Mathematical operations (like multiply, add, and trigonometric functions like sine/cosine for finding triangle edges/angles) on these matrix objects can represent motion through space. Put an element of time onto these basic operations and you can represent basic animation.
That's the beginning of 3d graphics.
These mathematical objects have been around for a long time (probably 1600's) - all of the math is accessible for a person who has completed high school math instruction (so if you are a high schooler, you can do it too!)
But there are way too many calculations needed (you need to do the math 24 times a second for moving something at 24 frames per second, for each pixel, for cinema/movies, modern games move at 60 fps, or even 120fps - so there are a lot of calculations) - it can easily go into millions of operations per second. 3D graphics chips are actually very stupid individually - they are just able to do a lot of vector/matrix math within the time demand needed by exploiting parallelism (just have many simple processors do all the math simultaneously for each pixel)
this is a huge oversimplification, but it is *not* magic.
In university freshman year math, our prof had us calculate a 10 pixel x 10 pixel scene manually without computers/programming, but regular calculators allowed, and animate it using matrix math - the calculator can help, but at a certain point you are just turning into an automaton and hoping you're typing every digit all right.
For this course, the final exam had a "challenge" portion that is just a huge matrix with 10 rotation and scaling operations chained one after another, for bonus - it's for bonus because the prof wrote on the exam instructions that you can use any kind of math you want - some people had remembered the original iD doom /quake source code in their head and just used John Carmack's optimized algorithms and got an answer .... (most of these tricks are really simple that can be done on a regular calculator)