this post was submitted on 13 Dec 2024
48 points (100.0% liked)

Explain Like I'm Five

14398 readers
1 users here now

Simplifying Complexity, One Answer at a Time!

Rules

  1. Be respectful and inclusive.
  2. No harassment, hate speech, or trolling.
  3. Engage in constructive discussions.
  4. Share relevant content.
  5. Follow guidelines and moderators' instructions.
  6. Use appropriate language and tone.
  7. Report violations.
  8. Foster a continuous learning environment.

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] e0qdk@reddthat.com 4 points 1 week ago

Games need to figure out what color to show for each pixel on the screen. Imagine shooting lines out from your screen into the game world and seeing what objects they run into. Take whatever color that object is supposed to be and put it on the screen. That's the basic idea.

To make it look better, you can repeat the process each time one of the lines hits an object. Basically, when a line hits an object, make more lines -- maybe a hundred or a thousand or whatever the programmer picks -- and then see what those lines run into as they shoot out from the point in all directions. Mix the colors of the objects they run into and now that becomes the color you put on screen.

You can repeat that process again and again with more and more bounces. As you add more and more bounces it gets slower though -- since there are so many lines to keep track of!

When you've done as many bounces as you want to do then you can shoot out lines one last time to all the lights in the game. If there is an object in the way blocking a light, the color for the object you're trying to figure out will be darker since it's in a shadow!

It's an old and simple idea to figure out what color something is like that by bouncing off objects repeatedly... but it's hard to do quickly. So, most games until very recently did not work that way. They used other clever tricks instead that were much faster, but made it hard to draw reflections and shadows. Games with those other techniques usually did not look as good -- but you could actually play them on old computers.