Eli5: What is digital image rendering?


The past eli5s are not eli5 enough for me, as I have very little experience in this area or in gaming.

In: 0

A monitor is made up of pixels. If you’re writing a computer program, and you want to draw something on a monitor, you have to tell the monitor which pixels it should turn on (and what color they should be).

Sometimes, you have a data file that tells you exactly what the pixels should be. This data file’s pixels might have been drawn by an artist, or they might have come from measurements of a physical object made by a digital camera or scanner.

However, often you don’t have a file. Instead you have some *geometry*, like “I want to draw a box that starts at (5, 5) with a width of 2 pixels and a height of 3 pixels”, or “I want to draw a line that starts at (0, 0) and ends at (11, 5).”

The computer then has to run a calculation to tell it which pixels it should draw. For the box, you turn on pixels with coordinates of (5, 5), (6, 5), (5, 6), (6, 6), (5, 7), and (7, 7). Drawing a rectangular box with horizontal / vertical edges is a simple problem that can be solved with two nested loops.

Drawing the line is harder. Your program needs to calculate the grey pixels in [this image](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm#/media/File:Bresenham.svg) from the endpoints of the black line. This is a deceptively complicated problem (especially if you want to stick to integer only calculations). The problem of figuring out which pixels to turn on to draw a line was [solved in 1962 by Jack Bresenham](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).

*Rendering* is the word used to describe how to compute pixels from geometry.

– Bresenham’s algorithm is used for rendering lines.
– You can also render curves (a specific type of curve called a [Bezier curve](https://www.youtube.com/watch?v=aVwxzDHniEw) turns out to be quite useful for computer graphics)
– You can render polygons, either filled or outlined
– You can do “3D rendering” which means your geometric coordinates have 3 dimensions, and the computer calculates the pixels as they would be seen by a camera, allowing a fictional 3D world to be displayed to the user
– Modern computers have powerful specialized processors for 3D rendering (called synonymously GPU / Graphics Processing Unit / graphics card)
– Modern computers often use fonts that are specified as geometry (lines and Bezier curves), so to display text a computer usually does “font rendering”
– A web browser deciding how to position all the boxes and bars on a website is also called “rendering”

Humans are visually oriented. Displaying things for humans to see is a big part of what we like to use computers for. Effectively all our computer displays use pixels. So rendering — calculating what the pixels should be — is an enormous field that covers a huge number of different topics.

If you want to learn about 3D rendering, one possible approach is hands-on. When you have a few idle hours on a weekend or something, look up a free software package called Blender. Install it. Then follow a Blender beginner tutorial on YouTube.

Can you give us an example of what you’re talking about? Any context at all?

Someone already gave a detailed answer but I feel like we can do better if we connect it back to whatever made you have this question in the first place. Where did you see that term?