This illusion is crazy if you really think about it!! It's called the checkershadow illusion. It looks like all the boxes are different shades of gray. Yet the box A and the box B are actually identical shades of gray. To put it simply, because of the shadowing and the light coming from the image that is making it look 3d, the shades of color look different.
For the shadow part of the illusion, our visual system needs to determine the color of objects in the world. The issue here is to determine the gray shade of the checks on the floor. By only measuring the light coming from a surface is not enough. The cast shadow will dim a surface. A white surface in shadow may be reflecting less light than a black surface in full light. Our visual system uses tricks to determine where the shadows are and how to compensate for them, in order to determine the shade of gray "paint" that belongs to the surface.
Sooooo what now??!! To explain further the checks may look lighter due to the position and color of their neighboring checks. Check B looks way lighter than check A because of the checks surrounding it being so dark. Also, our visual system tends to ignore gradual changes in light level.
This illusion also uses light and shadow cues. This creates a three dimensional form. To detect colors we use the lower visual pathway leading to the temporal lobe. The contrast we see of shades of gray makes us perceive different colors.
There are other images that create this same illusion. For example, the Chubb illuision also uses shades of gray that make us perceive two circles to be different colors, when really they are identical. This really interested me because due to contrast in the world we see things differently than they appear. Shadows also play a role. It's something to really think about!!