9
3D Geometry Math Concepts for Artists This document covers some basic math and computer science concepts that I have found to be extremely useful for polysculpting. I have tried to stay away from the academic and theoretical to inform you of some of the practical aspects of the math behind what you do. This knowledge will help your approach to polysculpting as well as help you troubleshoot issues that cause unnecessary crashes and other interruptions to your creative process. In conversations with artists I greatly admire, I am constantly surprised at how unaware they are about the underpinnings and foundations on which they have built their amazing work. I am referring specifically to artists who have chosen a computer and 3D as their medium, and whose work has manifested itself on screen, in books, on billboards, in movies, TV, toys, collectibles and many other forms. There are many layers upon which CG magic is built, and a lot of it is based on mathematical formulas and algorithms that some very smart mathematicians and computer scientists have advanced over the years. In this course, I will focus on the basics that are important to modelers, sculptors and creators of 3D form. Some of the information in this document might be obvious to you, but I have found that 3D artists need a comprehensive understanding to know what is going on behind the scenes, and that understanding is what will make their workflow more efficient, and prevent them from unpleasant crashes or backtracks that will hinder the creative process. If you are intimidated by math, don’t worry, as I have distilled and focused the information to be specifically applicable to 3D artists. If some of the topics are super-simple for you, please bear with me and read through, because every piece of information presented here builds on the previous topic, and my aim is to be as comprehensive as possible to not leave any holes in the buildup of the concepts for the course. One can always chop up some wood and make a chair, but to be an expert craftsman, one needs to understand the composition of the medium, balance, the woodworking toolset, the environment the chair will live in, the effect of seasons on the expansion and contraction of the joints and many other factors.

3D Geometry Concepts for Artists

Embed Size (px)

DESCRIPTION

3D Geometry

Citation preview

Page 1: 3D Geometry Concepts for Artists

1 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

3D Geometry Math Concepts for Artists

This document covers some basic math and computer science concepts that I have found to be

extremely useful for polysculpting. I have tried to stay away from the academic and theoretical to inform

you of some of the practical aspects of the math behind what you do. This knowledge will help your

approach to polysculpting as well as help you troubleshoot issues that cause unnecessary crashes and

other interruptions to your creative process.

In conversations with artists I greatly admire, I am constantly surprised at how unaware they are about

the underpinnings and foundations on which they have built their amazing work. I am referring

specifically to artists who have chosen a computer and 3D as their medium, and whose work has

manifested itself on screen, in books, on billboards, in movies, TV, toys, collectibles and many other

forms.

There are many layers upon which CG magic is built, and a lot of it is based on mathematical formulas

and algorithms that some very smart mathematicians and computer scientists have advanced over the

years.

In this course, I will focus on the basics that are important to modelers, sculptors and creators of 3D

form. Some of the information in this document might be obvious to you, but I have found that 3D

artists need a comprehensive understanding to know what is going on behind the scenes, and that

understanding is what will make their workflow more efficient, and prevent them from unpleasant

crashes or backtracks that will hinder the creative process.

If you are intimidated by math, don’t worry, as I have distilled and focused the information to be

specifically applicable to 3D artists. If some of the topics are super-simple for you, please bear with me

and read through, because every piece of information presented here builds on the previous topic, and

my aim is to be as comprehensive as possible to not leave any holes in the buildup of the concepts for

the course. One can always chop up some wood and make a chair, but to be an expert craftsman, one

needs to understand the composition of the medium, balance, the woodworking toolset, the

environment the chair will live in, the effect of seasons on the expansion and contraction of the joints

and many other factors.

Page 2: 3D Geometry Concepts for Artists

2 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

The Building blocks of 3D space

There are two base level constructors that are at the foundation of everything you do in 3D; vertices,

and bits.

If you have done anything in 3D, you understand coordinate space, and how every point in 3D space has

3 numbers referred to as coordinates x, y and z. These numbers define its position in space. These

points or vertices are the atoms of 3D with which everything you see is defined. From a geometric

perspective, every line, curve, surface, polygon, Transformer, Incredible Hulk or Na’vi starts out as sets

of vertices.

If we have two vertices with different coordinates, they can represent a segment of a specific line in

space.

If we have three vertices with differing coordinates, they form a triangle that lays flat on top of a specific

plane in space. In the following figure, you can see triangle A has defined plane B (the boundaries of

which are only represented in the image, but the actual plane is infinite)

Page 3: 3D Geometry Concepts for Artists

3 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

In basic high school geometry we have learned that any line can be defined by two points or vertices,

and a plane with three using these formulas

Line: y = mx + b , where the slope m = 𝒚2 − 𝒚1

𝒙2 − 𝒙1

Plane: Ax + By + Cz + D = 0

In the case of a line, if we are given the slope m, and the y-intercept b, then plugging in any x and y that

solve the equation will always be coordinates of points on the same line in space.

In the case of the plane, given the numbers A, B, C, D and 0, any x, y and z that we plug in which solve

the equation, will be points on the same plane in 3D space.

Unless you are coding 3D software or a plugin, or are a TD, there is no reason for you to remember

these formulas, but as an artist, you should know that everything you do in the interface of the

application you are in, uses formulas to calculate what you see and model. When you push those

formulas in a direction that the coder or the error correction in the code did not anticipate, you get an

unpleasant crash, or even worse, a hang. For example, if you have two overlapping edges between two

vertices and they are visible as one because they are overlapping, it will at some juncture, like when you

are trying to split the edge, confuse the software and give you unexpected results.

Page 4: 3D Geometry Concepts for Artists

4 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

So our basic construct is a vertex, of which two can define a line, and three can define a plane. These

constructs are combined in our 3D app to form shapes, so let’s look at the most basic way they combine,

let’s look at how they intersect:

If two vertices intersect, they can only do so if they have the exact same coordinates and they

result in the same vertex, nothing exciting here, but a very important concept to understand

when modeling with polygons. In most 3D Software, co-incident vertices result in the same

vertex.

If a line and a vertex intersect, the result is a vertex with the exact same coordinates as the

vertex we started with.

If a plane and a vertex intersect, the result is also the vertex with the exact same coordinates as

the vertex we started with.

When two lines that are not askew and not co-linear intersect, they intersect in one vertex. If

they overlap, they geometrically are the same line. However in 3D software they are not

considered as the same line and are stored separately, causing issues when doing polygonal

operations on them.

When a line and a plane intersect, they also intersect at one vertex.

When two planes that are not co-planar (not on the same plane in space) intersect, they

intersect in a line.

It is important to understand these concepts because they will help you create, edit and diagnose

problems in your polygon creation workflow.

Triangles and vertex order

If three vertices that form a plane are connected with lines, they form a triangle, the most basic polygon

with which everything is built in 3D apps (even NURBS get tessellated to triangles before they are

rendered). In some 3D applications, you can either display the underlying triangles that form the quads

or n-gons, or generate them using functions called tessellation or triangulation.

We will get to why we model with quads and not triangles, but for now, let’s stick to triangles because

there are some very important characteristics to know about them and how they are put together to

form surfaces.

To simplify how these triangles are put together, let’s consider a triangle strip where each triangle

shares one edge with the previous triangle. The 8 vertices 1, 2, 3, 4, 5, 6, 7, 8 form triangles A, B, C, D, E,

and F below. For this example, each triangle shares 1 and only 1 common edge. Triangle A and B share

an edge formed by vertices 2 and 3, B and C share the edge formed by 3 and 4 and triangles C and D, the

edge formed by vertices 4 and 5, and so on.

Page 5: 3D Geometry Concepts for Artists

5 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

Notice that the vertices are listed in an order that implicitly defines the triangles, for example:

The vertices that define triangle A are 1, 2 and 3

The vertices that define triangle B are 2, 3 and 4

The vertices that define triangle C are 3, 4 and 5

and so on.

The vertex order for this triangle strip is 1,2,3,4,5,6,7,8

To create triangle A, we start at 1 then draw a line to 2, then to 3, then to 1 again to close the triangle.

We draw these lines in a clockwise order.

Triangle B, draw a line 2, 3, 4 then to 2 again, and we draw these lines in a counter clockwise order.

Triangle C, draw a line 3, 4, 5 then to 3 again, clockwise.

Triangle D, draw a line 4, 5, 6 then to 4 again, counter clockwise.

Triangle E, draw a line 5, 6, 7 then to 5 again, clockwise.

Triangle F, draw a line 6, 7, 8 then to 6 again, counter clockwise.

Page 6: 3D Geometry Concepts for Artists

6 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

IN the figure above, we see arrows in which the triangles are formed. Notice that the reason the

rotation is inverted at every juncture is because the both adjacent triangles share an edge that has a

common direction. In the case of triangles A and B that edge is 2 to 3.

To connect these 8 vertices, into the same exact triangles, we have to follow the same vertex order,

which in our case here is 1, 2, 3, 4, 5, 6, 7 and 8. Even though we can attach these same 8 vertices to

form triangles different from A,B,C,D,E and F, having the vertex order succinctly describes this triangle

structure, and it’s a blueprint to recreate this particular triangle strip over and over again.

It is very important for the modeler to know that a vertex order exists and that the vertex order is

important when adding, deleting and editing polygons because if there are processes that are

dependent on a vertex order and encounter a different one, you may get unexpected results.

The order is created when you create your model. If the same exact model, with the exact same

coordinates for all the vertices is created in a different manner, it will have a completely different vertex

order. All polygonal operations traverse this vertex order to calculate resulting polygons, and this vertex

order is what is imported into other programs when you export you model.

In Maya’s display options, you can turn on the vertex order numbers to visually see the vertex number

of the vertices of your model. You can enable it in the Custom Polygon Display Options dialog box by

checking the vertices option in the Show item numbers section. It might also be a good idea to turn on

the Triangles option so you can see how the quads in your model are tessellated.

Page 7: 3D Geometry Concepts for Artists

7 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

As you can see on the 4 sided quad below the vertex order follows the same guidelines we encountered

in the triangle strip. Where 0,1,2 triangle has a counter clockwise order and the 1,2,3 triangle has a

clockwise order. If you had not turned triangles on, and didn’t know about vertex order, it would be

difficult to assess why the quad had an order of 0,1,3,2.

Also observe the vertex order on the subdivided quad, and the cube.

Page 8: 3D Geometry Concepts for Artists

8 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

Having understood vertex order and triangles that form a model, you can begin to understand why

quads are important, and why as you go up in valence, which is the number of edges that emanate from

a vertex, it makes it more difficult to traverse the vertex order and how calculations on the model can

get complex and indeterminate very quickly.

Normals

As we move up in the building blocks of our models, starting with vertices, connecting in edges, forming

faces made with triangles and quads, the next important building block is the normal of a face, which

helps us determine the direction the faces are pointing. For human interpretation, we can think of it as

inside and outside the model. For the software, Normals are used to compute lighting on the surface, to

determine backface culling and to denote where particles bounce off the surface of the mesh. By

default, in most software applications, faces are only visible if the normal points in a direction visible to

the viewport or camera, and the other side of the polygon is not shaded so you can see through the

faces that point away from the camera. Most software packages have options to turn on the visibility of

both sides, but that might cause confusion when you render the object and see that some faces are not

visible.

Bits and Computing

The other atoms upon which everything in computer generated 3D is built are bits, basically the two

numbers zero and one. In today’s modern binary computers, these two numbers are put together in

sequences of 8, 32 or 64 to form instructions and data for the processor in your computer. Bits

processed in multiple layers of programs which in turn are manipulated by the user are what makes it

possible to create your 3D models. Why is this important for the artist? Mainly because of the

parameters and settings you type in, or manipulate in your applications. Understanding the significance

of bits and the math behind them can make the difference between smooth progressions in your

workflow, or disastrous crashes that will waste hours of creative flow on what could have been your

Opus.

Have you ever wondered why you encounter certain numbers over and over again? Numbers like 8, 16,

32, 64, 1024, 2048, etc. It’s because of bits, and their representation. At the most basic level, bits are

manipulated in a computer using the binary numeral system, or a base-2 system. What is important for

you here is that units of information and the workings of your computer are based on multiples of 2. In

the following table, you can see the first 13 powers of 2, and as you can see, they are the numbers that

you encounter again and again, be it 16 Megs of RAM, a 64 bit operating system, an 8 bit TIF file, 128 bit

encryption and on and on.

Page 9: 3D Geometry Concepts for Artists

9 3D Geometry Math Concepts for Artists © 2013 Ara Kermanikian

Power of 2 Value

20 0

21 2

22 4

23 8

24 16

25 32

26 64

27 128

28 256

29 512

210 1024

211 2048

212 4096

213 8192

Besides knowing the significance of these numbers as the building blocks of the 3D software you are

using, the reason you should know and recognize them as a 3D artist is that if you use them as

parameters in sliders and dialog boxes for input, you are in fact typing in numbers that are in the native

language of your computer. For example, a 2048 by 2048 image is within the native language of your

computer while a 2000 by 2000 image is not. That’s why resolution and color depth of images, texture

maps and other parameters are almost always in the power of 2.

So as a takeaway from all this, when given a choice to enter an arbitrary number as a parameter for a

function, unless you have a specific number you have to use that is outside of the powers of 2, then you

will be safer using numbers that approximate to their nearest power of 2 number. For example, instead

of using 10, try 8. Instead of using 1000 try 1024 etc. Again, only do this if you do not have a specific

directive to use a specific number as a parameter, but are experimenting with parameters and sliders.

If you want to understand how your computer groups, organizes, processes and stores these bits, you

can pick up an introductory book on computer science, and read up on the building blocks of how your

computer works.

Further reading

CK-12 Basic Geometry, Volumes 1 and 2 : Basic geometry books available on iTunes for free.

3D Math Primer for Graphics and Game Development : (Wordware Game Math Library) - Jones &

Bartlett Publishers

Introductory book on computer science: many to choose from on Amazon.