BLENDER | LIGHT SHAFTS/GOD RAYS
To make a beam of light coming in through a window you have to use a spot light and not a sun/distant light. This took me a bit to figure out, but it seems Blender just doesn't support the sun light/lamp with volumes at the moment(based on the Blender Guru tutorial I watched to figure this out anyways). First scale it up to fit the window. Next you need to turn volume scattering on. To do this click on the world properties tab and scroll down to the "Volume" drop down. Open it up and select "Volume Scatter" from the drop down(either do that or attach it manually in the shader editor window). Turn the density down to .1. Next attach a "Light Falloff" node to the strength attribute of the "Emission" node of the spot light. Set the strength to 300 on the ligt path node. This will make the spot light more like sun light. And that's it. Also try to make sure the camera isn't inside the spot light cone - when I was testing at first the camera was in the cone and I was getting strange large black artifacts/shapes in my render. Also make sure to turn the volume samples in the render settings down from 1 to 0 if you want a cleaner/higher contrast final render. If you want a dustier look then leave it at 1.
Find the Blender Guru video where he goes over this process in more detail here - https://www.youtube.com/watch?v=VyLOZWevi8g
UPDATE:
Turns out this is only one way of doing it. You can also create a volume box/cube and if you do that the sun/distant light will be visible through the volume.
Originally posted: September 30, 2019