News for hackers. Stuff that matters.
Re:Computer Graphics from Scratch by aperrien on Wednesday February 03, 2021 @02:29PM (#26018022)
This is awesome, but as a kid back in the Pong era, I always wondered how the basic squares of pixels worked. In your travels writing this book, did you ever come across one that explained that in a way friendly to 12 year olds?
Re:Computer Graphics from Scratch by gamacodre on Wednesday February 03, 2021 @04:03PM (#26019070)
I was a 12 year old when I learned about them :)

The idea of a pixel is that it's the smallest area of the screen that can be independently controlled, thus the designation "pixel" for "picture element".

In most modern phone screens or monitors, each pixel is formed by a group of three smaller elements with fixed colors (usually red, green, and blue) but _variable brightness_. By controlling the brightness of these sub-elements, we can control what the overall color of the pixel appears to be - once you get more than an inch or two away from the screen, the light from the element group blends into what we see as a single color - so 100% green + 100% red + 0% blue looks like bright yellow. 50% each for red, green, and blue looks like a middling grey. You can usually see the structure of the pixel with a magnifying glass, though this is easier with an old TV or monitor than a modern phone.

These pixels are laid out on a regular rectangular grid, and your display controller will offer some way to set the color of each pixel and to then update them all at some (usually) regular interval, for example 60 times per second. In computers, it's common to keep a "frame buffer" around that stores separate values for the red, green, and blue components of every pixel on the screen. If these are 8-bit values, that implies that each R/G/B component can have 256 different levels of brightness, and in combination they allow each pixel to take on one of about 16,000,000 possible colors. So, a program can change pixel colors by writing different values into this buffer and waiting for the updated buffer to be processed by the display controller to change what the display is showing.

Of course, the electronics, physics, chemistry, timing, and logic of display generation have changed quite a bit since Pong. And not all displays even have pixels - vector displays used to be a thing, and are still used in some very specialized applications.

Re:Computer Graphics from Scratch by a9h74j on Wednesday February 03, 2021 @08:10PM (#26021381)
I once bought a schematic for a DIY pong. IIRC it used monostables and integrators to control timings -- scan frequencies yes but no strict pixels needed.
Re:Computer Graphics from Scratch by aperrien on Wednesday February 03, 2021 @04:12PM (#26019179)
I appreciate the explanation, but it's not for me. I'm trying to find a good book to recommend to my grandkids. I've had fun teaching them how to use old retro computers (c64, Apple II, and such). It's been a fun experience, but I'd like to give them some references that aren't me! I've personally come a long way in my computing skills since I was staring at shiny new Pong screens :)
Re:Computer Graphics from Scratch by gamacodre on Wednesday February 03, 2021 @05:19PM (#26019930)
That's trickier - somewhere along the way I stopped buying books and just do tactical forays onto the net when I need a new bit of domain knowledge.

Details like how and why pixels work are much easier to understand and retain if they're in some kind of context. Gamers learn about pixels to better understand the games or their gear. Devs learn about them in order to control them. Artists learn about them to better understand why computers mangle their art. So maybe choose an area the grandkids are engaged with and look for something there that also touches on display tech.

Re:Computer Graphics from Scratch by TimBurr on Wednesday February 03, 2021 @05:04PM (#26019760)
Thinking of when I was 12 (2005?), microscopes and magnifying glasses helped me understand. Depends on device DPI (cell phones have an insane number of pixels per inch; desktop screens are usually less dense).

If you can zoom in enough to see subpixel elements, and pull up a color wheel, it's very intuitive to see that the screen is made of pixels, and the pixels are made of three elements.

https://en.wikipedia.org/wiki/RGB_color_model#/media/File:Ad...

The Pico-8 might be a approachable way to explore retrocomputing. It's an in-browser console modelled after GameBoy-era consoles.

https://news.ycombinator.com/item?id=18240375

I don't know about books, though. I remember reading the binary/computers chapter of How Things Work and being thoroughly confused at that age. There was some extended allegory about white mammoths and black mammoths.

Re:Computer Graphics from Scratch by drewzero1 on Thursday February 04, 2021 @10:56AM (#26026446)
Did you have The Way Things Work or The New Way Things Work? I had the latter around the same time. I thought the extended computer section (Bill's Gates!) was very helpful. I still really like the visual in which the image of a mammoth is turned into a series of pumpkin/no pumpkin signals being launched through the air, then becomes a picture of a mammoth on the other side of the field. I think it got a bit too technical for me when it started showing how transistors are constructed-- I guess I should've stuck with the pumpkins.

Now I have both editions and have looked through them side-by-side. It's a bit unfortunate that some pages were dropped to make room for the expanded digital section in the newer edition, but well worth the trade-off for more/better explanations in the digital realm.

Re:Computer Graphics from Scratch by TimBurr on Thursday February 04, 2021 @03:52PM (#26029627)
I'm not sure. Possibly both?

Just took a look over my bookshelf, but they haven't made it with me through moves.

I do still have Incredible Cross-Sections. That was another of my favorites to flip through. It looks like there are reprints and new versions. Would definitely recommend for kids.

https://www.amazon.com/Stephen-Biestys-Incredible-Cross-Sect...

Re:Computer Graphics from Scratch by exDM69 on Thursday February 04, 2021 @05:14AM (#26024194)
Graphics was somewhat more complicated back in the day. In the days before we had enough memory to hold a full screen framebuffer, there was a lot of magic going on with cathode ray tubes, video signals, dedicated hardware sprite engines, memory access clock cycles, using interrupt handling to "race the beam" and so on.

It's not like modern display panels and HDMI signals and digital protocols are simple, but you don't have to go into the details to understand how pixels and framebuffers work.

If you're trying to explain how pixels work, going back to 1980s era technology is a detour into arcane technical details that aren't really relevant any more. They're pretty cool to read about if you're into retro computer technology but they don't have much educational value or relevance to the modern day.

Re:Computer Graphics from Scratch by II2II on Wednesday February 03, 2021 @08:17PM (#26021415)
If they're interested in retro computers, you can always try finding some books from the 1980's. Many titles were written for children. The Apple II was also a fun playground for computer graphics since it was supported in BASIC.
Re:Computer Graphics from Scratch by ggambetta on Wednesday February 03, 2021 @05:56PM (#26020327)
To some extent, I guess that's what I've tried to do here. The linear algebra might be too advanced for a 12 year old (I didn't pick it up until much later!), but on the other hand you don't need to follow all the derivations - a 12 year old can learn a lot just by following the results and the resulting algorithms.

There's also a linear algebra appendix [0] that presents the operations, explains how to use them, and how they can be interpreted, without going in any theoretical depth about why these things are the way they are.

[0] https://gabrielgambetta.com/computer-graphics-from-scratch/A...

Re:Computer Graphics from Scratch by kevin_thibedeau on Wednesday February 03, 2021 @02:45PM (#26018206)
Pong uses discrete logic gates and no microprocessor for its game logic and graphics. It isn't comparable to much else.
Re:Computer Graphics from Scratch by corysama on Wednesday February 03, 2021 @03:23PM (#26018625)
Can you be specific of the context you are interested in?

On modern machines, a pixel is just a set of three numbers indicating how much red, blue and green light should be shown at a particular point. Ex: {0.75 red, 0.0 blue, 0.5 green} for a kinda-dark, orange pixel. The GPU keeps a big 2D grid of these number-triples in memory and on a regular schedule sends out a copy over the DVI cable to your monitor. The monitor has a bit of memory to hold it's copy. And, it has hardware to scan over the grid of numbers to produce a sequence of voltage levels that are used to change the color of the points on the LCD.

There's a bit of math involved in how to do a good job representing colors with numbers and how to convert those numbers to voltages. But, at the most basic level, an image is just a big 2D grid of numbers. If you want to change the image, poke the grid. People want to change images a whole lot. So, we've developed pretty sophisticated hardware and software around poking 2D grid... But, that's a whole other topic.

Re:Computer Graphics from Scratch by foobarian on Wednesday February 03, 2021 @02:54PM (#26018325)
I was dismayed to learn that pixels are not square at all. It got worse with the switch to LCD.
Re:Computer Graphics from Scratch by vram22 on Thursday February 04, 2021 @11:52AM (#26027125)
Interesting, didn't know that. What shape are they, then? Round? Or other?
Re:Computer Graphics from Scratch by mmcgaha on Wednesday February 03, 2021 @09:52PM (#26022025)
Graphics programming in C by Roger T Stevens chapters 9-12.