Every material has an index of refraction that is linked to the speed of light in the material. The higher a material's index of refraction, the slower light travels in that material. The smaller the difference in speed between two clear materials, the less reflection will occur at the boundary and the less refraction will occur for the transmitted light. If a transparent object is surrounded by another material that has the same index of refraction, then the speed of light will not change as it enters the object. No reflection and no refraction will take place, and the object will be invisible.
Different glasses have different indices of refraction.
That's why a ghostly image of the rod remains even with the best index matching. This demonstration will work better on some days than others. Index of refraction is sometimes called optical density , but optical density is not the same as mass density . Two materials can have different mass densities even when they have the same index of refraction. The index of refraction depends not only on density, but also on the chemical composition of a material.