The TLDR answer to this question is not very satisfying but it contains the heart of the answer: Glass is transparent because photons are not absorbed by it.
For a more satisfying and deeper answer please read the rest of my post below.
First it is important to remember that light is mediated by the carrier particle called photons and photons have wavelengths. Low energy photons like microwaves, infrared light and red light have lower frequencies and longer wavelengths. Higher energy photons like ultraviolet light ("UV rays"), x-rays and gamma rays have higher frequencies and shorter wavelengths.
Second, it is important to know that electrons themselves also can be described as having a wavelength. Higher energy electrons would have shorter wavelengths and lower energy electrons would have longer wavelengths.
Third, it is important to understand that in any given atom, the negatively charged electrons occupy orbitals that surround the positively charged and heavier atomic nucleus.
These orbitals can be thought of as standing waves that wrap around the nucleus in 3-D. This also means that if the 'wrap-around' is not exactly right then the wavelengths will cancel out and that energy level cannot exist.
Only those energy levels where the electron wavelength wraps around correctly can exist. This means that the orbitals that the electrons occupy will be at discrete energy levels.
Now enter the photons.
Low Energy Photons
If a low energy photon, like the red one depicted in the figure at the top of the post, passed through an atom described by the energy levels in that figure, it will not have enough energy to kick an electron from a low energy level (E1) to a higher energy level (E2).
This means that this photon and this atom will simply not interact and the photon will carry right on through. Essentially that atom will be 'transparent' to that frequency of light.
Higher Energy Photons
Let's consider the green photon next. It is a higher energy photon and it has a shorter wavelength. The energy in this particular photon will be enough to kick an electron from the low energy level E1 to another higher energy level (E2, E3, etc.).
In this case the energy from that photon will be expended into the action of energizing an electron and the photon will effectively disappear. In this case, since the photon disappears the material will not be transparent to that wavelength.
So now you can see in an intuitive way how atoms are able to absorb energy at well defined frequencies. One colour may pass through a material whereas another one is absorbed.
Very High Energy Photons
Finally, let's think about the blue photon and let's say that it represent a UV photon. This is a very high energy photon and it has a very short wavelength.
This particular photon has more than enough energy to kick that electron at energy level E1 to higher energy levels. In fact, it has enough energy to kick that electron right out of that atom and free it. In this case the photon disappears as well and the material will not be transparent to that wavelength.
This is also what is called ionizing radiation and it can cause damage to materials. If that material happens to be your body then that damage will be to the cells in your body and that can cause more rapid ageing and also cancer (but that is a topic for another post).
Super High Energy Photons
An X-ray or Gamma-ray photon has even more energy than, say, the UV light in the previous example. In this case a photon like this it will either pass through the material or it will kick electrons out of their atoms. It all depends on something called a coupling constant. This is a topic that is too involved for a post like this but in brief, if the coupling constant is weak then it will tend to pass right on through and if the coupling constant is large then it will tend to be absorbed but ionize whatever atom it strikes.
Some materials like your bones will tend to absorb these photons more effectively and some materials like your skin, muscles and organs will tend to not absorb these photons. This is what makes x-ray such a useful diagnostic tool.
Closing Words
The reality is, as always, more complicated than the description in a brief post like this but I hope that this at least helped to move you towards a better understanding of the science behind transparency.
Before I go, if you learned nothing else from my post I hoped you learned to always wear sunscreen and/or to just limit your exposure time or even stay out of the sun altogether.
Thank you for reading my post.
Bonus Content
To see how I made the figure at the top of this article please see this post here - Bonus Content: How To Make A Diagram Of A Photon Bundle.
Post Sources
https://physics.stackexchange.com/questions/7437/why-glass-is-transparent
https://science.howstuffworks.com/question404.htm
http://hyperphysics.phy-astr.gsu.edu/hbase/mod4.html
https://en.wikipedia.org/wiki/Matter_wave
https://en.wikipedia.org/wiki/Photon
https://en.wikipedia.org/wiki/Atomic_orbital
https://en.wikipedia.org/wiki/X-ray
https://en.wikipedia.org/wiki/Gamma_ray
I also wrote a style guide (link here) for STEM posts that you might find interesting (or not, up to you).
.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I am afraid to ask about how you learned about police interrogation rooms. A school trip no doubt :)
A one way window actually isn't one way at all. It is just darker on the other side. The light from the dark side is just flooded out and overwhelmed by the light reflecting from your side.
To make a one way mirror, just 'sprinkle' silver atoms onto glass so that it is only half coated on average. Photons then have a 50/50 chance of either passing through or getting reflected.
Pro-tip: never use one way mirrors for your bedroom windows.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I will probably reference your article in an upcoming article (seems we have very similar interests!) where I want to do a bit of deep dive on camera sensors. One of the areas of interest is the concept of Quantum efficiency which essentially is the ratio of photons converted to electrons (at the sensor). There are a couple of concepts that I am still grappling with their which is the main reason I haven't written it yet :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Challenge #1 is understanding a difficult topic.
Challenge #2 is explaining it to an audience in a clear and interesting manner. This one can be really hard at times.
Looking forward to your new post when you get it all figured out.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hence people don't tan in the sunshine behind a window. 😀
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit