Ever wondered how Transformers makes such sleek amazing robots that look completely real? How Harry Potter puts the magic onscreen? How Pixar makes such adorable characters come to life?

Well, wonder no more! In this series, I'm going to explain how computers create the art that our talented artists direct them to. In this part one, I'm explaining the very basics, how everything is a triangle, and how those triangles get turned into an image. By the end of series, you should be able to have a knowledgeable conversation with any CG artist, and understand how computers are used to create the movies you love!

# Everything is a Triangle

That face? Made of triangles. That car? Made of triangles. Dolphin? Triangles. Landscape? Triangles. Gun? Triangles. In computer graphics, *everything* is made out of triangles. The reason they can make such intricate shapes is because there's *lots* of triangles. It's not uncommon for an object to be made out of millions of triangles. I've done it myself. Intricate scenes in AAA movies might be billions of triangles. Often triangles are even smaller than a single pixel.*

Why triangles though? Why not squares or circles or balls? Because triangles are the most concise, precisely defined, least ambiguous primitive possible for describing a surface in 3D space. You can fit them together edge to edge with no discontinuities or holes. They're simple to draw, but expressive enough to create any shape.

Triangles in 3D graphics are defined as an ordered list of 3 points. A point is an ordered list of 3 numbers, the x position, the y position, and the z position. The order of the points determines which side of the triangle is the "out" side of the surface, and which side is the "in" side. This is often referred to as the normal** of the surface.

# Computers Need a Camera

Without a camera, the computer has no idea what to draw. Sure, it knows the shape of the object it's drawing, but it can't begin the process until it knows what angle it's drawing it *from.* You do't want to spend 5 hours painstakingly creating a piece of art, and then have the computer draw it from an angle that doesn't even include your piece!

The camera in computer graphics might just be a virtual object, but it's usually got many of the attributes a real photographer has to worry about, such as focal length. Focal length changes perspective transformation that the camera does. It controls the amount of foreshortening. Close objects should appear bigger than far ones, right? Foreshortening is how much bigger they appear.

In computer graphics, you also get to play with a special type of camera that doesn't exist in real life - the orthographic camera. With this camera, there is no perspective distortion. Everything is at the same scale. It's kind of like looking down at a city from a satellite camera.

# The Two Camps of Rendering

There are two main ways of turning your camera and triangles into an image, rasterization and raytracing. Neither is better than the other; they both have different use cases and pros and cons.

### Realtime Rasterizing

The first technique is rasterization. This is used in games, and other applications that are drawn in real time on your computer. The crux of this technique is the perspective transformation matrix. I won't go into detail, but it basically takes everything in 3D and then does some math, and everything comes out in 2D. But you've still got 2D triangles, so you've go to walk through all the pixels on the triangle and put them on the output image. Be careful to draw the ones closer to the camera on top! (with a depth buffer) This is a very fast process that computers can do in parallel easily, so it's used in all kinds of games.

### Production Quality Raytracing

The other technique is raytracing. Basically, the computer shoots out a bunch of lines out of the camera at each pixel, figures out what they hit, simulates them bouncing around the scene, then uses that to figure out what color the pixel is. In terms of lighting, this technique can make the final result much more realistic and detailed. It also allows for a more true-to-life material design. This is a very physics based technique, approximating the behavior of the very real photons that bounce around the real world allowing us to see. But it takes a lot of time for this to resolve into a clear image, so this is generally restricted to things like movies and video clips.

I hoped you liked part one of my overview! If you have any questions feel free to ask, I know a lot about computer graphics. Part two will touch on textures and lighting. Part three will probably about animation.

*Truthfully, you can't arbitrarily compare a triangle's size to a pixel's size. I am talking about when the camera is positioned in such a way that triangles projected onto the image have less area on the image plane than a pixel.

** https://en.wikipedia.org/wiki/Normal_(geometry)

condra67 · 5년 전This is superb. When I see articles like this it reminds me how Steemit is fast becoming a cornucopia of useful information.

A1

jrkirby47 · 5년 전Thanks. After this I might do a more practical series explaining how to actually

docomputer graphics with Blender 3D.stellabelle75 · 5년 전this is really cool. I've made so computer graphics, but i'm impatient so it turned out weird.

maykor1552 · 5년 전who knows a lot about technology, has the world in his hands!

viebie36 · 5년 전Very informative! Thank you @jrkirby

wisehammer55 · 5년 전Thanks mate! Very well written, and yes, I love the fact 3d is full of triangles.

simo322225 · 5년 전very good job

williambanks69 · 5년 전@jkirby This is awesome! You should consider stopping by blender.org and doing some updates on their tutorials which have turned a bit stale lately.

Also, is it really still triangles or is it polygons now?

jrkirby47 · 5년 전There's a ton of blender tutorial out there, although blender.org isn't the best at featuring them.

Many 3D tools let you use polygons with more vertices. Commonly, using only quadrilaterals is what's recommended for most modeling techniques. But that's only a facade, behind the scenes everything gets split up into triangles before it's sent to the GPU and rendered.

justoneartist55 · 5년 전Hope to see more about CGI in steemit. I'm a 3d artist and I have start sharing my work here.

pueblo25 · 3년 전nice overview! thx

feeltheblade0 · 5년 전alniskobs1 · 5년 전Dear User known as @jrkirby

Steemit has a BOT problem! Your Vote Counts... Maybe

https://steemit.com/steemit/@weenis/bots-steemit-s-first-community-based-decision-on-bots-your-vote-counts-to-be-or-not-to-be-details-inside