It’s trickery, and it’s actually a pretty interesting trick. What you’re seeing is the combined effects of shading and normal mapping.
Shading is when the renderer uses positional data to calculate the color of a particular pixel on screen. There are a number of different techniques for this with differing results. Here is the first one, using a technique called “Flat Shading”. Flat shading is when the renderer adjusts the color of a polygon surface based on what it determines the color of the center of the polygon is.
You can pick out the individual polygons pretty easily here, right?
Now we’ll switch to a different shading technique. This one is called Phong shading. Instead of using the center of the polygon to determine what color the polygon is, the renderer will take the color value from the corners of each polygon and interpolate between them and the color value from the center of the polygon. This results in shading that is much more gradual and smooth, as you can see here:
If you look closely, you can see that the number of polygons here actually hasn’t changed. You should still be able to pick out the vertices along the outline of the “sphere” here. But it certainly looks a lot rounder, doesn’t it?
But this still has issues, because we might have something that’s very polygon-intensive, like a cobblestone street. This poses a problem - we want streets to be flat in terms of polygons, because it’s a street and you walk on it, but it should still visually look like cobblestones. You don’t want to spend extra GPU cycles rendering extra polygons for the street when you could spend them on hair or fingers or facial expressions or something, but you don’t want it to look flat either. So how do you fix this?
Have you ever seen the movie Indiana Jones and the Last Crusade? There was a scene in the movie where Indy has to take a step out into what looks like a bottomless gorge:
But he’s not really stepping onto a bottomless gorge, is he? If you look closely, you can see it. When you change the angle of the camera, you can easily see what’s actually going on:
The step of faith here is actually a cleverly painted (and flat) bridge to make it look like there’s a huge drop. From the viewer’s perspective, it looks 3D even if it actually isn’t. And since we have a computer fast enough to do all the calculations for us every frame, we can make it calculate what the 3D surface would look like from different angles and repaint it on the fly, even if the polygon we’re displaying is actually still flat.
This is called bump mapping (or often normal mapping, which is a specific kind of bump mapping). The way it works is that you apply a texture like this to the polygon, but instead of being directly displayed on the polygon, it’s used by the renderer to determine the way the pixel at that point should look in terms of height, even if the polygon is flat at that point. It simulates a bunch of different heights or depths, even though the polygon is still actually flat. The result is what you see to the top right - lighting as if it were bumpy or pock marked, but without actually needing additional polygons to get the visual effect.
The results of this can be pretty interesting. Take a look at these. This is a model with a lot of polygons in it to create a bunch of different shapes:
And here is a completely flat polygon with a normal map based off of the above shape applied to it:
You can see that the stuff that really sticks out far like the cone doesn’t look right, but the stuff that only pokes out a little bit like the donut and the hemisphere actually look pretty good for taking up no additional polygons at all. If you looked at both of them from directly above, without the side angle view, it’d actually be pretty tough to tell them apart without touching them. And that’s the point - it’s a way to fake heights and depths without adding extra polygons. This is why it works best on flat surfaces like walls and the ground that you view from (nearly) straight on:
These are both flat polygon roads, but the right side looks a lot more like it’s made of real stones than the left. There are other effects also at play, like specular maps (which are used to calculate how shiny/reflective or dull an object is) and more, but they also operate on the same sort of mathematical principles.
It takes a good artist to create the proper map textures for 3D models, and it takes a graphics programmer with a solid understanding of math to create the renderer that can do all of the proper calculations to take those maps and figure out exactly what color each pixel actually is. I will say that it can be pretty fascinating stuff.