Also with 3D anaglyph!
3D on the MCH2022 badge
So I set off to make the effect, starting with simple 3D drawing. It is mostly the same as 2D, with the exception of the extra dimension and an extra step.
3D has extra steps
Everything starts with the graphics stack getting a command (e.g. draw a rectangle of a certain size). The size and position of this shape is usually relative, so it needs to transformed into a set of absolute positions. For 2D, this would be perfect to draw right away, but for 3D, it's not so easy. 3D needs to be projected first. I'll get to how that works in a bit. Assuming projection is done, the next step is rasterisation. Rasterisation is the process of turning a shape defined by it's outline into a series of dots on a grid. In simpler terms; To rasterise is to produce the pixels you see based on the shape.
Projecting 3D into 2D
The reason for 3D having the extra step is because of how our eyes work.
Our eyes see farther away objects as smaller than close objects; the light covers a smaller portion of the eye.
Let's take a look at the diagram first. The horizontal blue line here represents the axis
You can see that
Finally, we're left with this formula:
This can be applied to the 𝑦 as well coordinate by simply substituting 𝑥 for 𝑦.
A demonstration with Suzanne, a built-in model from Blender
Suzanne rendered in realtime
Suzanne in 3D anaglyph
If you'd like to receive an email when I make a blog post, you can fill out the form below.