2D vs. 3D
Tags: mixedreality, beginners
Published: 2020-09-18 17:06:07

As you build Extended Reality (XR) experiences, you'll find yourself working in a 3D space. This can become a challenge for some beginners as there's now a whole new dimension to consider when building scenes and interactions. Before you dust off the ol' keyboard and open your favorite engine for development, take a moment to learn the difference between 2D vs. 3D.

## What is a Dimension?

A dimension is a measure of one direction. In our every day lives, we're surrounded by examples of the first three dimensions (some may argue first four). These dimensions are defined by width (x), height (y), and depth (z). Although scientists believe that there are 10 dimensions (hello time and parallel universes!), when working with XR, we focus mostly on the second and third.

## What is 1D?

The first dimension is defined by width (x). For example, consider a straight line on a piece of paper. The line only goes in 1 direction.

![A straight horizontal line is drawn to represent a one dimensional direction. The direction is on the x axis.](https://dev-to-uploads.s3.amazonaws.com/i/dlj6iswzkrw154rxvf9v.png)

## What is 2D?

The second dimension is defined by width (x) and height (y). Starting to sound like math?  This concept may sound familiar if you've ever looked at a chart with plotted points. Taking the straight line from earlier, we can add another direction to reflect width.

![A vertical and horizontal line are drawn to represent two dimensional directions. The horizontal line is on the x axis. The vertical line is on the y axis.](https://dev-to-uploads.s3.amazonaws.com/i/gt2nyzvy6jm8th5tvgo4.png)

We often see 2D in retro video games such as [Pac-Man](https://wikipedia.org/wiki/Pac-Man). Objects in a 2D space are flat in the sense that there's no depth to the object. 2D objects only have a width and height.

![A gif of Pacman heading in the direction of a pink ghost.](https://dev-to-uploads.s3.amazonaws.com/i/hjtxc4f22rmvvj1narfs.gif)

## What is 3D?

The third dimension is defined by width (x), height (y), and depth (z). Depth is the direction of going from front to back. Using the lines from earlier, we can add a third dimension to the line to reflect depth.

![A vertical, horizontal, and diagonal line are drawn to represent three dimensional directions. The horizontal line is on the x axis. The vertical line is on the y axis. The diagonal line is on the z axis.](https://dev-to-uploads.s3.amazonaws.com/i/x763rqjixsxxvw8lw7mb.png)

Let's look at this in a practical example - [Donkey Kong](https://wikipedia.org/wiki/Donkey_Kong)! In the original arcade version of Donkey Kong, Donkey Kong is presented as a 2D gorilla. He has no depth to his design. However, if we look at his character in Donkey Kong Country, well, we can view the gorilla from all sides. He has height, width, and depth.

![A 2 D version of Donkey Kong displays on the left. A 3 D version of Donkey Kong displays on the right.](https://dev-to-uploads.s3.amazonaws.com/i/zvt8hc58t75bul60grjq.png)

As this all relates to XR, you can have both 2D and 3D objects in a XR experience. More often, UI elements such as text is displayed in 2D (although you could include 3D text). The holograms in which users interact with are in 3D. 

Curious to learn more about realities? Follow the [#MixedReality](https://dev.to/t/mixedreality) tag!