Parallax mapping is like playing with paper cutouts, where you move one cutout forward and behind the other to create the illusion of depth. But instead of paper, it's a texture on a computer screen.
Let's say you are playing a video game and your character is walking through a forest. The trees in the foreground look bigger and closer to you, while the trees in the background look smaller and further away. This is called parallax, and it's what parallax mapping tries to recreate in video games.
Parallax mapping works by taking a 2D texture and creating the illusion of 3D depth. It does this by using a technique called displacement mapping. Basically, the computer moves the pixels on the texture up and down based on the angle they are viewed from. This creates an impression of depth.
For example, imagine a brick wall texture. In a regular video game, it would look flat, like a picture stuck to the wall. But with parallax mapping, the computer calculates the angle of the viewer's eye and uses that angle to make some bricks appear to stick out more or be more sunken in than others, just like a real brick wall would have. It's like creating a 3D version of the flat texture.
The effect is that the texture looks more realistic, creating the illusion of depth and making the game world feel more immersive. It's like looking at a painting and having the shapes jump out at you, creating a 3D effect.
In summary, parallax mapping is a technique used in video games to create the illusion of 3D depth in 2D textures. By moving pixels up and down based on the viewer's angle, a texture becomes more realistic and immersive, like looking at real-world objects in 3D.