Main content

## Pixar in a Box

### Course: Pixar in a Box > Unit 8

Lesson 1: Geometry of dinosaur skin- Start here!
- Introduction to Patterns
- What are shading packets?
- Shading Packets
- Voronoi Partition
- Constructing a Voronoi partition
- Distributing sites randomly
- Poisson disc process
- Modeling dino skin
- Make your own dino skin 1
- Getting to know Ana
- Getting to know Beth

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Voronoi Partition

Overview of Voronoi partitions. You can explore the interactive program used in this video here.

## Want to join the conversation?

**Interactive programs used in the video**:

Two draggable, expandable points: https://www.khanacademy.org/computer-programming/expanding-two-points/5633866140614656

Multiple expanding points: https://www.khanacademy.org/pixar/building-a-voronoi-diagram/5209320543617024(36 votes)- cool shape. How did u change the color from blue to yellow(8 votes)

- What does irregular shape mean?(9 votes)
- It means a shape where the side length and interior angles are not all the same. For example, a square is a regular shape because all its sides and angles are equal. And irregular shape would be one of shapes from the Voronoi diagram.(16 votes)

- does pixar use texture mapping?(8 votes)
- Texture mapping can also be really useful for pieces of paper and signs. But procedural textures, like the Voronoi Partition, Perlin Noise, or Musgrave, are fully mathematical, and therefore have
**essentially**infinite resolution. If you texture mapped the dinosaur's leg, for example, closeups would show pixels, and you would need a monstrously large texture to avoid pixels. You can't use a smaller texture and just tile it, because not only does the voronoi density have to change smoothly along its body, but there would be visible tiling and repeats in the texture. With a procedural texture, the dinosaur can have smoothly transitioning texture densities, no repeats, and nice-looking closeup shots – and remember, these procedural texture are also commonly mixed together in different ways! It is also essential in objects like CGI planets, as you don't want to just copy planets in the solar system imaged by satellites (that would be obvious), and you want really high detail. Satellite data of other planets is very patchy, varies in resolution, and has many seams where the color abruptly changes – these can of course be fixed, but, again, the audience may recognize that planet. It is just a lot more practical to use math to describe textures for that planet. But keep in mind – in some areas, these can be mixed!! In the case of paper, it may be useful to apply a musgrave or perlin noise texture as either displacement or a normal map to the paper, to increase realism. Both textures can be fractalized, meaning you can zoom into an extreme closeup shot of the dirt or something, and see the beautiful procedural detail. Lastly, like the dinosaurs here, many times you want to create something new, that cannot be photographed in real life.(5 votes)

- It will not let me watch the video again, a glitch?(8 votes)
- ya reload the page or quit the website u are using as safari or whatever u are using

and click on the icon with the left button on the mouse and hit quit then click it with the right side of the mouse. It should work or if it does not work its time to get a new website page like firefox or safari or another icon.(2 votes)

- Why these sites are grown in the same rate? Does the size of one of the sites depend on the distance between it to others?(6 votes)
- The aim is to draw dividing lines that are an equal distance from each site, so that means the sites must grow at the same time. As a result, the size of the final cell will depend on how close the other sites are to it.(6 votes)

- Poor cake, never got to show off it's beauty. :((7 votes)
- How do we represent the correct answer mathematically? RE:boarder vw distance = the same distance from site A & site C(1 vote)
- This is discussed in the second section of the Patterns course in the "Bonus Challenge". Basically, we're using a bit of algebra in the slope-intercept form to find to perpendicular bisectors of a triangle that matches up with all three points surrounding the vertex. Where they intersect is the vertex of the Voronoi partition.

I encourage you to check out the proof and algebra in the next section.(5 votes)

- at1:41when she was talking about cells then she said sites i think instead of saying sites you should say the nucleus because when you think of a cell you think of the nucleus of the cell(3 votes)
- i don't understand how all the sites have same distance(2 votes)
- The center points or starting point of each cell is random, so they aren't equally split up.

The walls are formed at the midpoint between 2 center points. So each wall is equal distance from the center of each cell.

With 3 cells, the the walls between each center point are equal distance from the center point....then the spot where 3 walls meet is a vertex point and that is equal distance from all three center points.

It's a triangle thing. The if each wall is a midpoint between 2 centers, the midpoint between all three centers will naturally have to touch all three walls....the only way for that to work is for a vertex to form that is equally distance from each center.(1 vote)

- Why do the subtitles call them "blonde" and "brunette" women?(2 votes)

## Video transcript

- [Woman] Now that you're
comfortable reading shading packets, let's get to work. - To begin, let's step back
and simplify the problem. A dino leg is essentially a cylinder, with claws at the bottom. - Let's ignore the claws for the moment. - And if we unwrap the cylinder, we get a flat rectangle, or a 2D plane. - We can do all the work
like this in a flat plane, and then wrap it up whenever
we wanna test it out. Let's first think about the
geometry of our dino scales. Each scale is an irregular shape, and all of these different
scales need to fit together like a puzzle. - At Pixar we use a really cool trick to generate these kinds of patterns. It's known as a Voronoi diagram. It's based on a pattern
we see all over the place in the natural world. From the spots on a giraffe,
to the spots that form when mud dries. - And I love that we can explain the math behind Voronoi patterns with bubbles. - [Brunette Woman] If we fill
a container with bubbles, like this, they squish together
and we get the same pattern based on where the bubbles touch. - [Dark-Haired Woman] Let's
think about the geometry of what's going on here. We start by places a few
points somewhere on the plane, doesn't matter where. - [Brunette Woman] Imagine
they are tiny bubbles, let's call these sites. - [Dark-Haired Woman]
And then we blow them up into larger bubbles. - [Brunette Woman] Eventually
the neighboring bubbles collide at a single point. As they expand, this grows into a line where they squish together. - [Dark-Haired Woman]
These bubble boundaries is where we draw our lines. - [Brunette Woman] And watch
what happens when we do this with many sites scattered about. We get this irregular puzzle pattern. - [Dark-Haired Woman] And that's it. A Voronoi pattern. - [Brunette Woman] Or Voronoi
partition, if you really wanna show off. - [Dark-Haired Woman]
We'll call each of these bubble regions a cell. So we have sites and cells. - [Brunette Woman] And there are some really interesting properties here. The border of each cell is
always the same distance to the two nearest sites. - [Dark-Haired Woman] And
wherever three lines meet, we get a point, or a vertex right here. And this is equally distant
to the three nearest sides, all thanks to the
awesome power of bubble-- ah, math. (both women laugh) - Let's stop here and make
sure that you understand how to draw these Voronoi patterns. - The following exercise
will get you thinking about how these work. It's also a great time to
grab a pencil and paper. Remember, doodling is your friend. - Do you have a good story
about Voronoi patterns? - I do. When we were working on The
Incredibles, we had this cake that was absolutely
beautiful, and it was made for Bob Parr was gonna take
a big bite out of it, and it was full of
these beautiful bubbles, and the crest was shiny, and it was moist and it was really really gorgeous. And then the story changed a little bit, and the shot ended up
being filmed all at night. - [Brunette Woman] So you
can never see all those beautiful Voronoi bubbles. - [Dark-Haired Woman] Sounds delicious. (both women laugh)